On 30 Aug 2013, at 13:58, Stéphane Ducasse <[email protected]> wrote:

> sven can you add it to the readme so that when I turn it into a pier chapter 
> we get it :)

https://github.com/svenvc/docs/blob/master/neo/neo-json-paper.md has been 
updated

>> Using the newly added NeoJSONCustomMapping>>#mapWithValueSchema: this is now 
>> possible, as the following unit test shows:
>> 
>> testDictionaryOfObject2
>>  | data json reader |
>>  data := Dictionary new.
>>  data 
>>    at: #one put: NeoJSONTestObject2 example1;
>>    at: #two put: NeoJSONTestObject2 example1.
>>  json := NeoJSONWriter toString: data.
>>  reader := NeoJSONReader on: json readStream.
>>  reader for: #DictionaryOfObject2 customDo: [ :mapping |
>>    mapping mapWithValueSchema: NeoJSONTestObject2 ].  
>>  self 
>>    assert: (reader nextAs: #DictionaryOfObject2)
>>    equals: data
>> 
>> Note that the mapping mechanism in NeoJSON is optional. Without mapping you 
>> get Arrays and Dictionaries back, that you can then convert to your domain 
>> objects in the a next step. With mapping however, these intermediary 
>> representations are not used and maps or lists are parsed while creating and 
>> populating your domain objects directly, which should be more efficient. 
>> This does of course introduce the necessity of adding some form of static 
>> typing.
> 


Reply via email to