- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2017 03:11 AM
Am getting response as below line,
"{\"Table\":[[\"Yes\"],null]}"
And it contains Yes, if Yes is present in response i need to do something, how to parse or split the response to identify Yes or No present in it?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2017 03:39 AM
Hi Swathi,
Here is the code. I have executed in background and value is coming as Yes
you can also test
var str = '{"Table":[["Yes"],null]}';
var parsed = new JSONParser();
var parsedData = parsed.parse(str);
gs.print('Value is:'+parsedData.Table[0]);
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2017 03:24 AM
Hi Swati,
You need to use the json parser in server side code. But the json string you shared seems to be incorrect.
Please share the proper json so that script can be provided.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2017 03:30 AM
Hi Ankur,
Thanks a lot for your reply.
How to parse response to fetch only 'yes'? Response is proper which i have shared.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2017 03:39 AM
Hi Swathi,
Here is the code. I have executed in background and value is coming as Yes
you can also test
var str = '{"Table":[["Yes"],null]}';
var parsed = new JSONParser();
var parsedData = parsed.parse(str);
gs.print('Value is:'+parsedData.Table[0]);
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2017 08:11 AM
Hi ankur I have similar kind of issue as I need to decode this value and I want the value of exp
"{\"alg\":\"RS256\",\"kid\":\"cert\"}",
"{\"scope\":[\"INA\"],\"client_id\":\"INA\",\"pi.sri\":\"CZRPnW66-JE6mPkZMfOM\",\"ssr\":\"resr\",\"snwd\":\"restuer\",\"Email\":\"D.Idaest1et\",\"exp\":1501162800}"