Code: Select all
[r: foo = json.set("", "bar", "A json string with 'quotes' and \"double quotes\".")]
Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice, MapTool BugReport Manager
Code: Select all
[r: foo = json.set("", "bar", "A json string with 'quotes' and \"double quotes\".")]
Code: Select all
[r: foo = "foo\\"bar"]
[r: foo = "foo\"bar"]
Code: Select all
[r: foo = json.set("", "bar", "A json string with 'quotes' and " + '"double quotes."')]
<br>
[r: json.get(foo, "bar")]
Code: Select all
{"bar":"A json string with 'quotes' and \"double quotes.\""}
A json string with 'quotes' and "double quotes."
Code: Select all
"fooo"bar"def" -> "fooo"+'"'+"bar"+'"'+"def"
I just avoid json's like the plague because of stuff like this.
Well, some people have few issues... or (more likely) just get used to working around the peculiarities. Particularly those used to using jsons elsewhere and who have a firm grasp of how MT parses things. But for the hackier macro writers (like myself) I just find I burn way too much time trying to figure out how to get around wonky issues like the one you encountered here and would just as soon use other methods so I can move onto other things. I find string lists/props to be more readable anyway, so unless I have to use a json, I don't.
I think it just depends upon what you are comfortable with. The issue isn't JSON its how Maptool handles extended characters and you can encounter the issue whatever way you store data.