[Pharo-users] Multiple NeoJSON mappings for the same domain object
emaringolo at gmail.com
Tue Feb 12 17:34:10 EST 2019
Hi all, Sven, :)
I'm working on a domain model that will have different JSON
representations for the same domain objects, so depending on the
context it will return one representation or another.
In the past to solve the multiple representations, what I did was to
build "helper" methods that added the mappings to the mapper.
So the process was like:
1. instantiate the mapper
2. call a #neoJsonSimple: mapper
3. configure the mapper by calling other mapping defining methods
4. convert the object to a JSON string.
If I wanted an "extended" representation, in the step 2 I would call
But I find this "too manual" to scale.
So... is there a better, ¿canonical?, way to achieve this?
ps: By now it will be only object -> JSON (so NeoJSONWriter), but in
the future I might need to instantiate objects back from JSON, so the
mappings should be for both mappers.
Esteban A. Maringolo
More information about the Pharo-users