- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2018 10:58 AM
Try this code in the background script:
var message = "{'short_description':'PROBLEM: agent on asdfasdf is unreachable for 5 minutes','contact_type':'alert','impact':'1 - High','urgency':'1 - High','service_offering':'asdfasdf'}";
var parser = new JSONParser();
var parsed = parser.parse(message);
gs.print(parsed.short_description);
How can I make it show the whole show_description value? I tried to escape with'\' no luck. Also anything I can do in the parser code to stop this?
Thanks and have a great day!!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2018 11:22 AM
Json requires double quote and I usually use JSON.parse for parsing Json objects.
Try this:
var message = '{"short_description":"PROBLEM: agent on asdfasdf is unreachable for 5 minutes","contact_type":"alert","impact":"1 - High"}';
var parsed = JSON.parse(message);
gs.print(parsed.short_description);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2018 11:22 AM
Json requires double quote and I usually use JSON.parse for parsing Json objects.
Try this:
var message = '{"short_description":"PROBLEM: agent on asdfasdf is unreachable for 5 minutes","contact_type":"alert","impact":"1 - High"}';
var parsed = JSON.parse(message);
gs.print(parsed.short_description);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2018 12:51 PM
THANK YOU!!!