Re: [Pharo-users] NeoJSON mapping question

2019-02-27 Thread BrunoBB
Hi Sven, Excellent !!! That exactly what i want. As an excuse i will say i'm one day old with NeoJSON :) mapping decoder: [:x | ] plus #atPath: made my day ! Thanks very much for you clear response. regards, bruno -- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Re: [Pharo-users] NeoJSON mapping question

2019-02-26 Thread Sven Van Caekenberghe
> On 26 Feb 2019, at 22:23, Esteban Maringolo wrote: > > El mar., 26 feb. 2019 a las 17:57, Sven Van Caekenberghe > () escribió: > >> PS: Note also that mappings can live on the class side (where they are >> global), but also inside specific NeoJSONReader instances (where they are >> local)

Re: [Pharo-users] NeoJSON mapping question

2019-02-26 Thread Esteban Maringolo
El mar., 26 feb. 2019 a las 17:57, Sven Van Caekenberghe () escribió: > PS: Note also that mappings can live on the class side (where they are > global), but also inside specific NeoJSONReader instances (where they are > local), like here. This postscript should be a whole section in the docs,

Re: [Pharo-users] NeoJSON mapping question

2019-02-26 Thread Sven Van Caekenberghe
Bruno, What about the following ? json := '{ "id" : 1, "level1" : { "level2" : { "name" : "foo" } } }'. In the JSON above there is a nesting level1.level2.name that you want to skip over. One solution would be: NeoJSONReader new on: json readStream; for: #Foo customDo: [ :mapping | ma

Re: [Pharo-users] NeoJSON mapping question

2019-02-25 Thread BrunoBB
Hi, Finally i found a much more acceptable solution :) neoJsonMapping: mapper "Map the receiver from a json with " mapper for: self do: [ :mapping | mapping mapAccessor: #locator mutator: #setLocator: to: 'booking'. ]. setLocator: aDictionary loc

Re: [Pharo-users] NeoJSON mapping question

2019-02-25 Thread BrunoBB
Hi, The following implementation do what i want without the need to create a class for each level of the JSON, however i really dislike my solution. neoJsonMapping: mapper "class side" "Map the receiver to a json with " mapper for: self do: [ :mapping | (mapping ma

Re: [Pharo-users] NeoJSON mapping of nil properties

2014-06-02 Thread stepharo
and now available as pdf and html in the pfte project :) https://github.com/SquareBracketAssociates/PharoForTheEnterprise-english and https://ci.inria.fr/pharo-contribution/job/PharoForTheEnterprise/lastSuccessfulBuild/artifact/NeoJSON/NeoJSON.pier.html Stef

Re: [Pharo-users] NeoJSON mapping of nil properties

2014-06-02 Thread stepharo
found it and converting it to pillar https://github.com/svenvc/docs/blob/master/neo/neo-json-paper.md Stef On 2/6/14 22:19, stepharo wrote: Sven I added a section to new empty chapter on NeoJSON :) Do you have a doc about NeoJSON that I can use to fill up the chapter :) On 29/5/14 14:39,

Re: [Pharo-users] NeoJSON mapping of nil properties

2014-06-02 Thread stepharo
Sven I added a section to new empty chapter on NeoJSON :) Do you have a doc about NeoJSON that I can use to fill up the chapter :) On 29/5/14 14:39, Esteban A. Maringolo wrote: 2014-05-28 16:03 GMT-03:00 Sven Van Caekenberghe : Hi Esteban, Your wish is my command ;-) In #bleedingEdge you can

Re: [Pharo-users] NeoJSON mapping of nil properties

2014-05-29 Thread Esteban A. Maringolo
2014-05-28 16:03 GMT-03:00 Sven Van Caekenberghe : > > Hi Esteban, > > Your wish is my command ;-) > > In #bleedingEdge you can now do: > > String streamContents: [ :stream | > (NeoJSONWriter on: stream) > writeNil: true; > mapAllInstVarsFor: Point; > nextPut: Point new. > >

Re: [Pharo-users] NeoJSON mapping of nil properties

2014-05-28 Thread Sven Van Caekenberghe
Hi Esteban, Your wish is my command ;-) In #bleedingEdge you can now do: String streamContents: [ :stream | (NeoJSONWriter on: stream) writeNil: true; mapAllInstVarsFor: Point; nextPut: Point new. which will give you: {"x":null,"y":null} instead of: {} which rem

Re: [Pharo-users] NeoJSON mapping

2013-09-27 Thread Sven Van Caekenberghe
Actually, for the reading part, this variation might be clearer: (NeoJSONReader on: '{"id":13,"data":"aaa","extent":{"x":250,"y":110}}' readStream) for: NeoJSONTestObject2 customDo: [ :mapping | mapping reader: [ :jsonReader | | object | object := NeoJSONTestObject2 new. jsonRea

Re: [Pharo-users] NeoJSON mapping

2013-09-27 Thread Sven Van Caekenberghe
Norbert, On 25 Sep 2013, at 18:21, Norbert Hartl wrote: > Is it possible to make a mapping for NeoJSON that an object shape maps to a > different shape. I mean if it is possible to have a class with instVars: > > Foo > +name > +x > +y > > that maps to > > { > 'name' ; …, > 'point' :