Forum Discussion
Hello @peter
You can use JSON Path to get the Record and sysid in the mapper. Write the path to the sysid location, try this in the mapper jsonPath($, “$entity.result.sysid”).
Best Regards
Dimche Saveski
Hi that is great, never thought of that!
Sadly I keep getting an error.
My string is.
[
{
“response”:
{
“statusLine”:
{
“protoVersion”:
“HTTP/1.1”
“statusCode”:
200
“reasonPhrase”:
“OK”
}
“entity”:
“{“result”:{“status”:“success”,“message”:“Requested Item created: RITM1941111”,“record”:“RITM1941111”,“sysid”:“60f3d2eadbe7041001”,“automation_id”:null,“automation_version_id”:null}}”
My command is, jsonPath($,“$response.entity.status.record.sysid”)
“failure”: “Expecting object for JSON-Path field reference ‘status’, found: String”
Thanks for your help.
- dimche_saveski6 years agoNew Contributor III
Try 2 separate mappings. First one jsonPath(dollarSign,“$response.entity.result.record”)
and second one jsonPath(dollarSign,“$response.entity.result.sysid”)Alternatively try these mappings
$response.entity.result.record
$response.entity.result.sysidRegards
Dimche- peter6 years agoNew Contributor III
The error seems to be related to data type being returned.
- dimche_saveski6 years agoNew Contributor III
Peter
That maybe the case because there are quotation marks just after entity and before result field name, that are making it into string. Please check if this is original response from Service Now, or you have edited and added quotation marks by mistake.
Regards
Dimche