json building help required
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 11:29 AM
i want to sent one json payload from service now
{
"projectId": "ba080779-242d-432a-828f-8d442b7dbac7",
"inputs": {
"jsonInput": "{variables of catalog task}"
},
"bulkRequestCount": 1
}
I am trying by below way using the strings,after getting the variables using the variable...please suggest best approach
var extravar=('{'+'\r\n'+'"'+"projectId"+'"'+':'+'"'+'ba080779-242d-432a-828f-8d442b7dbac7'+'"'+',\r\n'+'"'+"inputs"+'"'+':'+ '{\r\n'+'"'+"jsonInput"+'"'+':'+'"');
gs.info(extravar+j.encode(output)+'"'+'\r\n'+'}'+',\r\n'+'"'+"bulkRequestCount"+'"'+':'+1+'\r\n'+'}');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 11:36 AM
Hi @rajasekahr ,
Use stringify method for payload
var jsonExtravar = JSON.stringify(extravar);
Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 12:18 PM - edited 07-10-2024 12:23 PM
Hi @rajasekahr ,
Please check the below article, it will provide you insights:
JSON PARSING: USE CASE AND SOLUTIONS
Mark this as Helpful / Accept the Solution if this helps
Mark this as Helpful / Accept the Solution if this helps.