Parse Nested JSON Array and objects

triciav
Kilo Sage

I have a RestMessage that I am getting back the JSON as below,

How do I parse this to get the SerialNumbers?

Thank you

find_real_file.png

{
"Devices":[
{
"EasIds":{
"EasId":[
"XXPI8PIKDD4LP5ID797BVKSGKO",
"XXFDA7DB295B406C9933FA634B190B77"
]
},
"Udid":"00000000-000A6C940E30802E",
"SerialNumber":"xxxxxxxxx",

1 ACCEPTED SOLUTION

your obj is the data

//try the following code

 

var json = new global.JSON();
var obj = json.decode(responseBody);
gs.info("TRICIA Json " + obj.Devices[0].SerialNumber);
for(i = 0; i<= obj.Devices.length-1; i++)
{
gs.info(obj.Devices[i].SerialNumber);
}

Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Vinod Kumar Kachineni
Community Rising Star 2022

View solution in original post

10 REPLIES 10

I did post it in above threads