how can i read Json data for specific parameters
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2023 07:44 AM
Hi Team,
Below is the JSON data updated in 1of the variables in catalog item.
{
"id":"123",
"region":"us-east-1",
"name":"123@gmail.com"
} i above JSON i need to read id & name details. how can i develop script for the same.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2023 07:49 AM - edited ‎11-19-2023 07:54 AM
@Emp 53 Here is how you should do it.
var ritm = 'RITM0010014'; //Replace with RITM number
var gr = new GlideRecord('sc_req_item');
gr.addQuery('number', ritm);
gr.query();
var jsonVar='';
while(gr.next()) {
jsonVar = JSON.parse(gr.variable.variable_name); //replace variable name with variable containing JSON data
gs.info(jsonVar.id);//will print id
gs.info(jsonVar.name);//will print name
gs.info(jsonVar.region);//will print region
}
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2023 08:34 AM
Hi @Sandeep Rajput,
Tried That bit received below error
Evaluator: com.glide.script.RhinoEcmaError: Unexpected token: u script : Line(155) column(0)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2023 08:52 AM
@Emp 53 Could you post your script here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2023 08:59 AM - edited ‎11-19-2023 09:00 AM