cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1160
Views
5
Helpful
3
Replies

Escape Characters in "Create JSON Document" Step

greg.burmeister
Level 1
Level 1

I am using a REST call to get a JSON reply back from our CRMs API - this all works and I get the reply placed in a string variable.

When I watch a reactive debug, the string variable with the JSON response is using escape charaters for the double quotes as below which I would expect is normal for a string:

 

sResponse String U"[  {    \"id\": 70333  }]"

 

I then am using a Create JSON Document step to put the string into a JSON doc for parsing but while watching in the reactive debug, the DOC value following this step still contains the escape characters and the subsequent Get JSON Document Data step to parse it fails:

 

dJSONOutput Document TEXT[[  {    \"id\": 70333  }]]

 

JSON path I am using is $.*.id which I have validated using JSONpath

 

Full script attached:

 

Am I missing something to get the JSON properly in the document? Any help would be much appreciated!

 

Thanks,
Greg

1 Accepted Solution

Accepted Solutions

Your JSON data needs to have the data be in double quotes as well as the id

 

Capture.PNG

The back slash is the normal Java escape character for the double queue and does not cause a problem

This little script works OK and extracts the 70333

Capture.PNG

Capture.PNG

Graham

 

View solution in original post

3 Replies 3

greg.burmeister
Level 1
Level 1

Ended up scrapping the built-in 11.6 JSON steps and just using custom Java classes to parse out the JSON. 

Your JSON data needs to have the data be in double quotes as well as the id

 

Capture.PNG

The back slash is the normal Java escape character for the double queue and does not cause a problem

This little script works OK and extracts the 70333

Capture.PNG

Capture.PNG

Graham

 

Thanks Graham! 

 

Tried that out and it works as well.