Ask a Question

JsonOutput.toJson adding \

akv33800
New Contributor

JsonOutput.toJson adding \

def mainElement= element1: [ {"key" : "value", "key2" : "value2","element2": [{ "key3" : "value3"}, {"key4" : "value4"} ]
element2 was already formed with JsonOutput.toJson
JsonOutput.toJson(mainElement) is resulting in:
element1: [ {"key" : "value", "key2" : "value2","element2":[{\"key3\":\"value3\"},{\"key4\":\"key4\"}]
how to remove the ones \ that got added?
2 REPLIES 2
richie
Community Hero

Re: JsonOutput.toJson adding \

Hey @akv33800,

Its escaping your quote marks.....??

Found this stackoverflow...it might help.

https://stackoverflow.com/questions/56591946/how-to-remove-escape-characters-in-jsonoutput-tojson

Ta

Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
akv33800
New Contributor

Re: JsonOutput.toJson adding \

thanks for your reply.

when i use this json for further tests the \ char is not causing any problems. So i let it remain in the json.

cancel
Showing results for 
Search instead for 
Did you mean: