Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2020 10:48 PM
Hi,
you can convert that XML to JSON and then parse the JSON
For converting xml to json refer this link
Script I tried
var jsonString = '{"set1":{"attr1":"123"},"set2":{"attr2":"xyz"},"attr3":"value1","attr4":"value2"}';
var parser = JSON.parse(jsonString);
var attr1Value = parser.set1.attr1;
var attr2Value = parser.set2.attr2;
var attr3Value = parser.attr3;
var attr4Value = parser.attr4;
gs.info(attr1Value);
gs.info(attr2Value);
gs.info(attr3Value);
gs.info(attr4Value);
Output:
Regards
Ankur
Regards,
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader