Tech Tip: How to parse JSON that contains double quotes
PRODUCT: 4D | VERSION: 18 | PLATFORM: Mac & Win
Published On: April 1, 2020
When trying to parse JSON string that contains double quotes, you will need to handle the double quotes carefully. Take the example below:
C_TEXT($text_t) C_OBJECT($obj_o) $text_t:="{\"name\":\"Jack said, \"Hello.\"\"}" $obj_o:=JSON Parse($text_t) |
Running the code returns the error below since only escaping the double quotes is not enough to validate the JSON.

Instead, escape both the backslash and the double quotes in order for the command JSON Parse to parse correctly.
C_TEXT($text_t) C_OBJECT($obj_o) $text_t:="{\"name\":\"Jack said, \\\"Hello.\\\"\"}" $obj_o:=JSON Parse($text_t) |
