How to get some selected values to get printed from json object?

sabbani rishika
Tera Contributor

script needed

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you should be able to parse using JSON parser and get the values

Since you said it's confidential one we can just provide example from our side and rest part you need to take care of.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

7 REPLIES 7

Hi,

if you are receiving object then directly parse and no need to use JSON parser.

but if you are receiving string then you need to use JSON parser.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

When i run the background script i'm geting object in place of some field values...why is it so?

Pathan
Tera Contributor

Hi 

Calling object values like below. similarly you can get your object values if values in object only

var obj={
'key1':'value1',
'key2':'value2'
};

gs.info(obj.key1);
gs.info(obj.key2);

output:-
*** Script: value1
*** Script: value2