Json Parsing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2023 06:56 AM
In a variable called jsonRet , Servicenow Business rule called "Recalculate" on pm_project_task table stores the json object attached in the below file .
I want to parse this object and get the value of
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2023 07:29 AM
Hi @Aishwarya Pulas ,
Try below script
var jsonRet = plannedTaskAPI.recalculateTaskWithPreviousGr(current, true, tasksToRecalculate, previous);
gs.log("jsonRet " + jsonRet);
try {
var parsed = JSON.parse(jsonRet);
var dvScheduleEndDate = parsed.tasks[0].dv_schedule_end_date;
gs.log("dvScheduleEndDate " + dvScheduleEndDate);
} catch (error) {
gs.log("Error parsing JSON: " + error);
}
Thanks,
Anand