I probably need to send a bit more info.

My latest attempt was this:

    mapper := NeoJSONReader new.

    mapper for: #RootObject customDo: [:mapping | mapping mapWithValueSchema: 
#TransferMessage].

    mapper

        for: #TransferMessage

        do: [:mapping |

            (mapping mapInstVar: 'Data' to: 'Data') listOfElementSchema: 
SomeExistingSmalltalkClass].


which results in

Symbol does not understand allInstVarNames

Please note there is no class named #TransferMessage in my Image. This works for things like #ArrayOfPoints in the examples on the NeoJSON git page and it also works in some of my other JSON mappings in different contexts.

I guess this is because I cannot map to instvars if there is no class/object to store values into... So do I really need to implement an otherwise useless Smalltalk class just to have something to map the outermost {} object to?

I also tried variations of for:customDo: for the mapping of the #TransferMessage and had no success so far.

Any ideas?


Joachim


Am 26.09.17 um 08:29 schrieb jtuc...@objektfabrik.de:
Hi there,


I am having a hard time configuring a NeoJSONReader for a JSON file like this:

{
    "Paging": { someStuff
       },
    "ErrorMessage": null,
    "ErrorCode": 0,
    "Data": [
        {object1},

        {object2}

        ]

}


Where I want to ignore everything but the list named "Data". (Of course I'll have to take a look at ErrorMessages later, but one step after the other...).

I've tried several combinations of mappers and always end up with NoeJSON parsing Exceptions. I semm unable to see the obvious.

In The end I just want to only use the contents of the Data list and map each entry in there to some smalltalk object. I was successful with other structures and lists, but this time I am unable to see the forest among all those trees.

Any hints?


Joachim






--
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel          mailto:jtuc...@objektfabrik.de
Fliederweg 1                         http://www.objektfabrik.de
D-71640 Ludwigsburg                  http://joachimtuchel.wordpress.com
Telefon: +49 7141 56 10 86 0         Fax: +49 7141 56 10 86 1


Reply via email to