1
ArrayList al = new ArrayList();
//al[0] and al[1] are the json objects.
def json = new JsonBuilder()
json {
   type "rel12"
   total k
   xyz ""
   shows al[0],al[1]
   emails ""
}

println json.toPrettyString()

i dont want to do the the hardcoding like al[0]. al[1]. but i need the output like

{
    "type": "rel12",
    "total": 2,
    "xyz": "",
    "shows": [
        {
            "extension": "zip",
            "updateTime": 1477521104511
        },
        {
            "extension": "zip",
            "updateTime": 1477521104623
        }
    ],
    "emails": ""
}
dmahapatro
  • 49,365
  • 7
  • 88
  • 117
abhay kumar
  • 379
  • 1
  • 3
  • 12

0 Answers0