
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2023 07:57 AM
Hi,
I'm trying to parse to json the result of a soap call as follows in an Action:
Step 3 in the action
(function execute(inputs, outputs) {
var treenodeOMS = JSON.parse(inputs.oms_response);
gs.info('EC OMS Get Tree Node ID | ObjectType = ' + treenodeOMS.ObjectType);
})(inputs, outputs);
But I'm getting the following error message:
Anybody has a clue why I'm getting this error message?
Thanks in advance
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2023 08:34 AM
@Tomi Corigliano From the screenshot, it is evident that the input variable
inputs.oms_response
Contains 
 ASCII code for Carriage Return, encoded as an XML character reference. Due to this, the JSON.parse method is crashing. Remove this XML character from string using string.replace method, and use JSON.parse to convert the JSON string to object.
Hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2023 08:34 AM
@Tomi Corigliano From the screenshot, it is evident that the input variable
inputs.oms_response
Contains 
 ASCII code for Carriage Return, encoded as an XML character reference. Due to this, the JSON.parse method is crashing. Remove this XML character from string using string.replace method, and use JSON.parse to convert the JSON string to object.
Hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2023 12:17 AM
Thank you, I indeed had to do a replaceAll:
var response = inputs.oms_response.replaceAll(' ','');