- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2019 07:33 AM
I have a RestMessage that I am getting back the JSON as below,
How do I parse this to get the SerialNumbers?
Thank you
{
"Devices":[
{
"EasIds":{
"EasId":[
"XXPI8PIKDD4LP5ID797BVKSGKO",
"XXFDA7DB295B406C9933FA634B190B77"
]
},
"Udid":"00000000-000A6C940E30802E",
"SerialNumber":"xxxxxxxxx",
Solved! Go to Solution.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2019 09:18 AM
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);
}
Vinod Kumar Kachineni
Community Rising Star 2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2019 08:06 AM
var data = {}; //your json
Vinod Kumar Kachineni
Community Rising Star 2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2019 08:12 AM
What do you mean by this?
var data = {}; //your json
This is my code
var json = new global.JSON();
var obj = json.decode(responseBody);
gs.info("TRICIA Json " + obj.Devices[0].SerialNumber);
var data = {obj}; //your json
for(i = 0; i<= data.Devices.length-1; i++)
{
gs.info(data.Devices[i].SerialNumber);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2019 09:18 AM
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);
}
Vinod Kumar Kachineni
Community Rising Star 2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2019 09:23 AM
Thank you so much vkachineni
This is working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2019 09:02 AM