I just committed: === Name: STON-Core-SvenVanCaekenberghe.76 Author: SvenVanCaekenberghe Time: 6 June 2016, 10:34:01.602265 am UUID: 71eeced4-4b1a-4648-90fa-c89efa709ba6 Ancestors: STON-Core-SvenVanCaekenberghe.75 When in JSON mode, STONWriter should also signal an STONWriterError when an Association is seen (thanks Peter Uhnák) Update #testRestrictedClassesInJSONMode to cover this case === Name: STON-Tests-SvenVanCaekenberghe.66 Author: SvenVanCaekenberghe Time: 6 June 2016, 10:34:19.068183 am UUID: 9df675c2-98a7-4644-b4d3-2231ba7c7444 Ancestors: STON-Tests-SvenVanCaekenberghe.65 When in JSON mode, STONWriter should also signal an STONWriterError when an Association is seen (thanks Peter Uhnák) Update #testRestrictedClassesInJSONMode to cover this case === Thanks again, Peter, for reporting this. Sven
On 05 Jun 2016, at 13:15, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Peter,
On 05 Jun 2016, at 13:10, Peter Uhnak <i.uhnak@gmail.com> wrote:
Hi,
shouldn't this throw an error instead of producing a broken JSON?
STON toJsonString: ({'a' -> 'b'}) ["a":"b"]
(also STON toJsonString: ('a' -> 'b') => "a":"b")
Clearly I forgot to cast it to dictionary, but shouldn't it throw up?
Thanks, Peter
Yes, when working in JSON compatibility mode, it would better throw an error.
The reason for this behaviour is because STON knows the concept of an association as a separate, primitive object. That was a cool contribution done later on. In normal use, you don't see this.
I'll have a look.
Sven