fork(4) download
  1. //Define value or assign it dynamically for target and source as shown below
  2. def tValue = 0
  3. def sValue = 1
  4.  
  5. def json = new groovy.json.JsonBuilder()
  6. json {
  7. source sValue
  8. target tValue
  9. }
  10. println json.toPrettyString()
Success #stdin #stdout 0.84s 4456448KB
stdin
Standard input is empty
stdout
{
    "source": 1,
    "target": 0
}