String to JSON conversion error

have a scenario where input is JSON , however since there is chance of getting an invalid json the procedure used to parse this json treats it as a string.
Everything is fine but it breaks when json field value contains double quotes in value. how can we handle this.

eg: Description says 2" , this double quote after two is causing JSON conversion error.
{
“SHOES”:[
{
“TYPE”:“STILETOES”,
“CODE”:“ST-BL-2-001”,
“DESCRIPTION”:“2” Back Pointed",
“BRAND”: “XYZ”,
“COLOR”:“BLACK”
}
]
}

Can you try escaping the double quotes with a backslack?

https://www.google.com/search?q=json+escape+double+quotes&rlz=1C9BKJA_enUS785US785&oq=json+escape+&aqs=chrome.1.69i57j0l3.8332j0j7&hl=en-US&sourceid=chrome-mobile&ie=UTF-8

Need to escape the one only after 2 for description field so that it is treated as part of value.

fixed it using transform, though had to change SP to trim starting and ending double quotes.

1 Like