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 >>

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 |

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

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

[Pharo-users] NeoJSON mapping question

2019-02-25 Thread BrunoBB
Hi, How to set a path to JSON value in the mapping definition ? I mean i have a simple object with and instance variable but the value of this inst var is deep inside the JSON. mapping mapInstVar: #locator to: 'locator'. This fail because 'locator' is not in the first JSON level. Is possible