Groovy web console

subscribe to the feed Subscribe
to this
site
Test Groovy Add to list (via #groovywebconsole)
tweet this snippet Tweet
this
script

Test Groovy Add to list

Published 2 months ago by cvillemure with tags groovy list add
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
import groovy.json.*   

def pipelineObject = new JsonSlurper().parseText('{"name":"","stages":[]}')

def stageObject = new JsonSlurper().parseText('{"name":"","projects":[]}')

pipelineObject.stages.add(stageObject)

println JsonOutput.toJson(pipelineObject)