Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How can we parse nested JSON

Ankita9793
Tera Contributor

Hi All,

 

How can we parse nested JSON? I tried it as below, it shows '[object Object],[object Object]'

 

 var request = new sn_ws.RESTMessageV2(restMessage, restMethod);
        for (var p in params) {
            if (p == "returnObj"){

                request.setStringParameterNoEscape(p, JSON.stringify(params[p][0]));
            }
            gs.info('params[p]' + JSON.stringify(params[p]) +JSON.stringify(p));
            request.setStringParameterNoEscape(p, params[p]);

        }
 Ankita9793_1-1752498999688.png

JSON DATA :

{"returnObj":[{"RequesterUserId":"45333530","RequestCategory":"01","ServiceNowFormNumber":"RITM1234","ScTaskNumber":"SCNum01234","AdminSystemName":"MDM","CustomerNumber":"042721608","KycRm":"072"},{"RequesterUserId":"45333530","RequestCategory":"01","ServiceNowFormNumber":"RITM1234","ScTaskNumber":"SCNum01267","AdminSystemName":"MDM","CustomerNumber":"350802601","KycRm":"610"}]}

5 REPLIES 5

Bhimashankar H
Mega Sage

Hey @Ankita9793 ,

 

I hope you saw my reply.

----------------------------------------------------------------------------------------
If my answer helps you or resolves your query, please consider marking as 'Accept As Solution'. So future readers with similar questions can find it easily. Your coordination will help community to grow stronger!.
----------------------------------------------------------------------------------------

 

Thanks,
Bhimashankar H