[Pharo-users] Is it bad to have an order NeoJsonObject?

Paul DeBruicker pdebruic at gmail.com
Thu Jun 7 01:31:10 EDT 2018

Tim Mackinnon wrote
> Hi - I’ve hit some Json where the outputted values (they are field names)
> are written out in a specific order - and the author hasn’t chosen to use
> an array to represent those fields in a specific order.
> { ‘field1’ : { ….}, ‘field2’: { … } }
> I think this is technically incorrect and should be:
> { [ {‘field1’ : { ….}, ‘field2’: { … } ]}
> Anyway - given what I’ve got, would it be a terrible idea to create my own
> version NeoJsonObject and just make it a subclass of OrderedDictionary?
> I can’t see any issues - but then I might be kidding myself…
> Tim

Seems like those are two different JSON objects. The first is what you'd get
from a NeoJSONObject holding a Dictionary.  The second is what you'd get
from a NeoJSONObject holding an Array holding a Dictionary as its only
element.  Maybe just double check that the right object is getting created.  

For JSON (https://json.org/) I think the order of the keys does not matter,
but the hierarchy does, so making an OrderedDictionary subclass seems extra.   

Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

More information about the Pharo-users mailing list