Hi Paul,

There are several issues here.

NeoJSON cannot know that OrderPreservingDictionary is in fact a Dictionary, 
since it inherits from Collection. For that to work you have to add copy over 
the method

neoJsonOn: neoJSONWriter
        neoJSONWriter writeMap: self

This will work for encoding, but when decoding you will get back normal 
Dictionaries (or the #mapClass that you set on your reader). JSON does not 
encode types.

Also, there are various implementations of ordered Dictionary out there in the 
wild. From Pharo 4 we have OrderedDictionary. NeoJSON cannot support them all, 
hence it supports none ;-)

STON does solve this problem.

Sven

> On 28 May 2015, at 09:55, Paul Wilke <wi...@itsys24.de> wrote:
> 
> Hi,
> there is a bug when converting OrderPreservingDictionary's into a json
> string.
> 
> NeoJSONWriter toString: (OrderPreservingDictionary new
>                                               at: 'key' put: 'value'; 
>                                               yourself).
> -->["value"]
> 
> In Pharo 2 the answer was as expected: {"key":"value"} 
> 
> 
> 
> --
> View this message in context: 
> http://forum.world.st/OrderPreservingDictionary-does-not-properly-convert-to-json-anymore-tp4829014.html
> Sent from the Pharo Issue Tracker mailing list archive at Nabble.com.
> _______________________________________________
> Pharo-bugtracker mailing list
> pharo-bugtrac...@lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker


Reply via email to