I have a Json that has this format:
{
"id": 12,
"fields": {
"name": "Hello Pharo"
}
}
And I would like to import it in a Pharo Object.
My Pharo class has two attributes: id, and name.
To perform the deserialisation I'm using NeoJSON.
I got it for id, but how to map an inner attribute such as name
| reader |
reader := NeoJSONReader on: entity contents readStream.
reader
for: MyObject
do: [ :mapping | mapping mapInstVars: #( id ) ].
reader nextAs: MyObject]
Do you know how one can use the NeoJSON lib to perform such read mapping?
Not my own answer, but I got this asking around: