Re: [Pharo-users] NeoJSON sorting instance variables/properties

2018-07-25 Thread Peter Uhnák
he > Sent: 25 July 2018 17:49 > To: Any question about pharo is welcome > Subject: Re: [Pharo-users] NeoJSON sorting instance variables/properties > > > > > On 25 Jul 2018, at 17:54, Henrik-Nergaard wrote: > > > > Hi Peter, > > > > This functionall

Re: [Pharo-users] NeoJSON sorting instance variables/properties

2018-07-25 Thread PBKResearch
Kenny -Original Message- From: Pharo-users On Behalf Of Sven Van Caekenberghe Sent: 25 July 2018 17:49 To: Any question about pharo is welcome Subject: Re: [Pharo-users] NeoJSON sorting instance variables/properties > On 25 Jul 2018, at 17:54, Henrik-Nergaard wrote: > > Hi Pe

Re: [Pharo-users] NeoJSON sorting instance variables/properties

2018-07-25 Thread Sven Van Caekenberghe
> On 25 Jul 2018, at 17:54, Henrik-Nergaard wrote: > > Hi Peter, > > This functionallity is already available in STON where it preserves the > order when you use an OrderedDictionary. > And was implemented for the usecase of dealing with fileout and versioning. > Perhaps the same could be ad

Re: [Pharo-users] NeoJSON sorting instance variables/properties

2018-07-25 Thread Henrik-Nergaard
Hi Peter, This functionallity is already available in STON where it preserves the order when you use an OrderedDictionary. And was implemented for the usecase of dealing with fileout and versioning. Perhaps the same could be added to NeoJson so that instead of some magic flag you provide an Order

Re: [Pharo-users] NeoJSON sorting instance variables/properties

2018-07-25 Thread Sven Van Caekenberghe
> On 25 Jul 2018, at 11:34, Peter Uhnák wrote: > > Ah, you are right that it might not be human-friendly. > > I don't want to rely on the order, but for (file) versioning it is quite > valuable. (or rather changing the order can easily make versioning quite > worthless). Ah, OK, I understa

Re: [Pharo-users] NeoJSON sorting instance variables/properties

2018-07-25 Thread Peter Uhnák
Ah, you are right that it might not be human-friendly. I don't want to rely on the order, but for (file) versioning it is quite valuable. (or rather changing the order can easily make versioning quite worthless). I can manually sort it, but it creates a lot of mess: (NeoJSONWriter on: stream) pr

Re: [Pharo-users] NeoJSON sorting instance variables/properties

2018-07-25 Thread Sven Van Caekenberghe
From json.org "An object is an unordered set of name/value pairs." IOW, it is not in the spec, it would be dangerous to rely up it in any way (not that you are suggesting that). It might look better sometimes, but even then alphabetic sorting might not be the most human friendly or most mea

[Pharo-users] NeoJSON sorting instance variables/properties

2018-07-25 Thread Peter Uhnák
Hi, would it be possible to provide option to automatically sort instance variables when serializing objects? Either always sorted NeoJSONObjectMapping>>writeObject: anObject on: jsonWriter jsonWriter writeMapStreamingDo: [ :jsonMapWriter | (properties sorted: #propertyName ascending) do: [ :eac