- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2019 11:00 AM
When I’ trying to map data from a JSON getting an error saying “The field not found in JSON Object”.
But the field is existing in the JSON.
Can anyone suggest me how can I overcome this issue? Adding the pipeline for more exposure.
CostCenter_2019_06_18.slp (12.9 KB)
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2019 12:36 PM
Some of the elements of the array, $['soapenv:Body'].searchResponse['platformCore:searchResult']['platformCore:recordList']['platformCore:record']['tranGeneral:lineList']['tranGeneral:line'][*]
, did not contain a department. One way to handle this would be to add a default value for the department prior to reading the values.
Here’s the expression I used to check if it’s there, otherwise return a default value. I just used null here, but you can adjust to your taste.
$.hasPath('tranGeneral:department') ? $['tranGeneral:department'] : {'@internalId': null}
Then use the same approach in the downstream mapper and read all the values. Since all elements now contain a department, it doesn’t choke in the same way.
Your example with my addition.
CostCenter_with_defaults_2019_06_18.slp (14.1 KB)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2019 12:36 PM
Some of the elements of the array, $['soapenv:Body'].searchResponse['platformCore:searchResult']['platformCore:recordList']['platformCore:record']['tranGeneral:lineList']['tranGeneral:line'][*]
, did not contain a department. One way to handle this would be to add a default value for the department prior to reading the values.
Here’s the expression I used to check if it’s there, otherwise return a default value. I just used null here, but you can adjust to your taste.
$.hasPath('tranGeneral:department') ? $['tranGeneral:department'] : {'@internalId': null}
Then use the same approach in the downstream mapper and read all the values. Since all elements now contain a department, it doesn’t choke in the same way.
Your example with my addition.
CostCenter_with_defaults_2019_06_18.slp (14.1 KB)