On 19 Mar 2013, at 13:14, "Esteban A. Maringolo" <[email protected]> wrote:

> Yes, I find out that.
> But I wanted to have the JSON serialization to be context-dependant.
> 
> And that's what I achieved by means of the custom mappings.
> 
> Again, kudos for making it so fast and memory-savvy, being stream based with
> no internal transformations makes it almost a basic printOn: aStream.

Thanks, that was indeed the idea.

> One question that remains is... how to map the same accesor/instVar to more
> than one attribute.
> eg.
> neoJsonMapping: mapper
> 
>  mapper for: self do: [:mapping |
>    mapping mapAccessor: #reference. "full"
>    (mapping mapAccessor: #reference to: 'reference-id) valueSchema:
> #ReferenceId "just its ID"
>  ].
> 
>   mapper for: #ReferenceId customDo: [:mapping |
>      mapper encoder: [:obj | obj id printString ]
>      "..."
>   ]
> 
> If I do that, I end up having the full reference twice.

I think I understand what you want, and I know that you tried to explain the 
model (or a minimal version of it), but if you are writing out JSON according 
to some externally defined format (with the ideas and sharing), would it be 
possible to give me the specification of that format ? Maybe off list ?

In any case, I will think about the issue you raised.

Sven

--
Sven Van Caekenberghe
http://stfx.eu
Smalltalk is the Red Pill


Reply via email to