Forum Discussion
Hi Rao
I wanted to create the JSON as below as This is dynamic based on number of records fetched from the query. Reqyestpayload attribute is of type JSONArray
{
"requestPayload": [
{
"ORDERID": "H001",
"LINEID": "L001",
"HOLDID": "1",
"HOLDNAME": "HOLDA",
"RELEASED_FLAG": "N"
},
{
"ORDERID": "H001",
"LINEID": "L001",
"HOLDID": "2",
"HOLDNAME": "HOLDB",
"RELEASED_FLAG": "N"
},
{
"ORDERID": "H001",
"LINEID": null,
"HOLDID": "3",
"HOLDNAME": "HOLDC",
"RELEASED_FLAG": "N"
}
]
}
Thanks
Jayant Agarwal
- nmrao8 years agoChampion Level 3
Please find the script below:
https://github.com/nmrao/groovyScripts/blob/master/json/ConvertDBResultToJson.groovy
Use log.info instead of println
You can quickly run try this quickly online as well
- nmrao8 years agoChampion Level 3
Related Content
- 4 years ago
Recent Discussions
- 22 days ago