STON doesn't produce valid JSON - it shouldn't escape quation mark
\â is not a valid JSON escape character, so STONâs JSON ouput is not a valid JSON string. ston := STON toJsonString: 'element''s'. -> "element\'s" neo := NeoJSONWriter toString: 'element''s'. -> "element's" NeoJSONReader fromString: ston. -> invalid escape character \â Peter
Peter, You are right, that is a bug. STON should be a bit more strict when it is in JSON mode. I'll fix it and let you know. Thanks for reporting this issue. Sven
On 19 Nov 2016, at 17:46, <i.uhnak@gmail.com> <i.uhnak@gmail.com> wrote:
\â is not a valid JSON escape character, so STONâs JSON ouput is not a valid JSON string.
ston := STON toJsonString: 'element''s'. -> "element\'s" neo := NeoJSONWriter toString: 'element''s'. -> "element's"
NeoJSONReader fromString: ston. -> invalid escape character \â
Peter
I committed the following in STON (sthub.com, ss3.gemstone.com & github.com) #bleedingEdge: === Name: STON-Core-SvenVanCaekenberghe.78 Author: SvenVanCaekenberghe Time: 20 November 2016, 7:48:23.799323 pm UUID: ee198da8-80e8-4944-ba9b-dffae331c57c Ancestors: STON-Core-SvenVanCaekenberghe.77 In JSON compatibility mode STON should not encode single quotes. (Thanks Peter Uhnák for reporting this). Patch STONWriter>>#encodeCharacter: Fix the encoding of forward slash ($/). This was already in the (external) documentation. Patch STONWriter class>>#initializeSTONCharacters - force STONWriter class>>#initialize to change too Fix the representation of Time by adding nanoseconds when there are any. This was already in the (external) documentation. Patch Time>>#stonOn: Adjust unit tests accordingly (esp. STONWriterTests>>#testDoubleQuotedString). Minor comment changes. === Name: STON-Tests-SvenVanCaekenberghe.68 Author: SvenVanCaekenberghe Time: 20 November 2016, 7:48:46.115446 pm UUID: 70402f28-f0e8-44e9-8746-3539c4add09b Ancestors: STON-Tests-SvenVanCaekenberghe.67 In JSON compatibility mode STON should not encode single quotes. (Thanks Peter Uhnák for reporting this). Patch STONWriter>>#encodeCharacter: Fix the encoding of forward slash ($/). This was already in the (external) documentation. Patch STONWriter class>>#initializeSTONCharacters - force STONWriter class>>#initialize to change too Fix the representation of Time by adding nanoseconds when there are any. This was already in the (external) documentation. Patch Time>>#stonOn: Adjust unit tests accordingly (esp. STONWriterTests>>#testDoubleQuotedString). Minor comment changes. === Now you get NeoJSONReader fromString: (STON toJsonString: 'single='' & double="'). "'single='' & double=""'" STON toString: { Time now. Date today. DateAndTime now }. "'[Time[''19:51:15.452023''],Date[''2016-11-20''],DateAndTime[''2016-11-20T19:51:15.454147+01:00'']]'" STON toString: 'back-slash=\ & forward-slash=/'. "'''back-slash=\\ & forward-slash=\/'''" Sven
On 19 Nov 2016, at 20:56, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Peter,
You are right, that is a bug.
STON should be a bit more strict when it is in JSON mode. I'll fix it and let you know.
Thanks for reporting this issue.
Sven
On 19 Nov 2016, at 17:46, <i.uhnak@gmail.com> <i.uhnak@gmail.com> wrote:
\â is not a valid JSON escape character, so STONâs JSON ouput is not a valid JSON string.
ston := STON toJsonString: 'element''s'. -> "element\'s" neo := NeoJSONWriter toString: 'element''s'. -> "element's"
NeoJSONReader fromString: ston. -> invalid escape character \â
Peter
Thanks! P On Sun, Nov 20, 2016 at 08:02:35PM +0100, Sven Van Caekenberghe wrote:
I committed the following in STON (sthub.com, ss3.gemstone.com & github.com) #bleedingEdge:
=== Name: STON-Core-SvenVanCaekenberghe.78 Author: SvenVanCaekenberghe Time: 20 November 2016, 7:48:23.799323 pm UUID: ee198da8-80e8-4944-ba9b-dffae331c57c Ancestors: STON-Core-SvenVanCaekenberghe.77
In JSON compatibility mode STON should not encode single quotes. (Thanks Peter Uhnák for reporting this). Patch STONWriter>>#encodeCharacter:
Fix the encoding of forward slash ($/). This was already in the (external) documentation. Patch STONWriter class>>#initializeSTONCharacters - force STONWriter class>>#initialize to change too
Fix the representation of Time by adding nanoseconds when there are any. This was already in the (external) documentation. Patch Time>>#stonOn:
Adjust unit tests accordingly (esp. STONWriterTests>>#testDoubleQuotedString).
Minor comment changes. === Name: STON-Tests-SvenVanCaekenberghe.68 Author: SvenVanCaekenberghe Time: 20 November 2016, 7:48:46.115446 pm UUID: 70402f28-f0e8-44e9-8746-3539c4add09b Ancestors: STON-Tests-SvenVanCaekenberghe.67
In JSON compatibility mode STON should not encode single quotes. (Thanks Peter Uhnák for reporting this). Patch STONWriter>>#encodeCharacter:
Fix the encoding of forward slash ($/). This was already in the (external) documentation. Patch STONWriter class>>#initializeSTONCharacters - force STONWriter class>>#initialize to change too
Fix the representation of Time by adding nanoseconds when there are any. This was already in the (external) documentation. Patch Time>>#stonOn:
Adjust unit tests accordingly (esp. STONWriterTests>>#testDoubleQuotedString).
Minor comment changes. ===
Now you get
NeoJSONReader fromString: (STON toJsonString: 'single='' & double="'). "'single='' & double=""'"
STON toString: { Time now. Date today. DateAndTime now }. "'[Time[''19:51:15.452023''],Date[''2016-11-20''],DateAndTime[''2016-11-20T19:51:15.454147+01:00'']]'"
STON toString: 'back-slash=\ & forward-slash=/'. "'''back-slash=\\ & forward-slash=\/'''"
Sven
On 19 Nov 2016, at 20:56, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Peter,
You are right, that is a bug.
STON should be a bit more strict when it is in JSON mode. I'll fix it and let you know.
Thanks for reporting this issue.
Sven
On 19 Nov 2016, at 17:46, <i.uhnak@gmail.com> <i.uhnak@gmail.com> wrote:
\â is not a valid JSON escape character, so STONâs JSON ouput is not a valid JSON string.
ston := STON toJsonString: 'element''s'. -> "element\'s" neo := NeoJSONWriter toString: 'element''s'. -> "element's"
NeoJSONReader fromString: ston. -> invalid escape character \â
Peter
participants (3)
-
i.uhnak@gmail.com -
Peter Uhnak -
Sven Van Caekenberghe