Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
SRP_Json doesn't escape double quotes anymore?
After upgrading to the latest SRP Utilities, the SRP_Json module doesn't convert double quotes to \" anymore. This was working in the older version.
So this produces:
If SRP_Json(ArrayHandle, "New", "Array") then
SRP_Json(ArrayHandle, "AddValue", "12345")
SRP_Json(ArrayHandle, "AddValue", '12345 Iets met \"blabla\"')
SRP_Json(ArrayHandle, "AddValue", 67890, "Number")
SRP_Json(ArrayHandle, "AddValue", 1, "Boolean")
JSON = SRP_Json(ArrayHandle, "Stringify", "Fast")
SRP_Json(ArrayHandle, "Release")
end
[12345,"12345 Iets met "blabla"",67890,true]
Comments
That library, however, would not translate to 64-bit, so we rolled out our own, which is why the feature disappeared. Not because we ignored it, but because--as far as we were concerned--it wasn't there in the first place. An oversight, in retrospect, but it helps explain where our design philosophy was at.
The goal of SRP_JSON is to use BASIC+ conventions so OI developers don't have to worry about json-specific encoding. Your example above would have worked just fine in any version of SRP Utilities without the backslashes.
If altering your code is not an option, let me know and I will provide you a download link for version 1.6.
Also I would expect when a dedicated JSON library is created, that this would follow the official JSON specs. Like you said; the library was created so that developers don't need to worry about json-specific encoding. So in that perspective I'm not sure what you mean with "if altering your code is not an option". Do you mean we have to check out every place where we use the JSON encoder, and first use a SWAP to convert al our double quotes to \" ??
The RFC stated clearly that the double quotation mark should be escaped with a backslash.
Eventually we managed to restore our original SRP Utilities from backups, so our panic situation it over for now. I do like to use latest stable versions though, because usually other bugs are fixed in these versions. So I'd like to know how SRP_JSON behaves in this 1.6 version. If you disagree about the escaping, maybe it's possible to implement it as an option when stringifying?
So this code: produces this output: .. with unescaped double quotes.
Sorry if this caused confusion, my bad.
So the expected output, was of course: IMHO the SRP_JSON functions should properly escape the characters in the string automatically to comply with the json standards.
I always like to provide pre-releases (or Release Candidates) before sending them out into the wild. All my unit tests pass, but I'd appreciate it if you downloaded version 2.0.2 RC1 and confirmed that it works to your expectations as well.