Quotes in JSON

I have string constants containing double-quotes (ASCII 34) entered into the IDE, e.g. my constant is “xyz” including the quotes, and to put that into a constant in the IDE I enter ““xyz””.

I subsequently assign that constant to a value in a dictionary, which gets turned into a JSON string via GenerateJSON, which gets written to disk via TextOutputStream.

When I read the file back from disk with TextInputStream, all the double quotes have been turned into \u0022 (literally, the string “\u0022”, not the quote character represented by \u0022 :slight_smile: )

AFAIK TextOutputStream and TextInputStream both default to UTF-8, so why isn’t \u0022 converted back to quotes when I read my file?

Do you read it back in with ParseJSON?

That’s a json convention, and has nothing to do with UTF-8. As Tim implied, using ParseJSON will properly convert it back.

Yes

Thanks, guys. I wrote a test app and it seems to work fine; the issue probably has to do with the constant being stored in and retrieved from xml prior to its being written as JSON. I’ll have to look at my xml escaping stuff.