List of objects can also occur in JSON-Object notation form not just JSON-List form.
Hi I'm getting the following error when loading some of my json Data.
Class '_CompactLinkedHashMap' has no instance method 'map'.
NoSuchMethodError: method not found: 'map' Receiver: Instance of '_CompactLinkedHashMap' Arguments: [Closure: (dynamic) => dynamic]
[[Sniped Stacktrace pointing towards error in hammock_core]]
This only occurs with some Lists of entities but not all.
The Stacktrace points to
QueryResult<Resource> jsonToManyResources(type, json) => new QueryResult(json.map((j) => jsonToResource(type, j)).toList());
all I could figure out is that json.map seems to not exists. It looks like you are expecting a different object from the JSON decoder than the one you get. This occurs in Dartium with manually configured serializers/deserializers hammock_mapper worked, but i can't use it due to its usage of reflection, which is incompatible with dart2js
Turns out the Backend was responding with funny JSON answers for the affected Objects.
Instead of responding with [{"id":1,...},{"id:2,....}] it responded with {0:{"id":1,...},{"id:2,....}} I dont know if the second is valid JSON or not. thus i leave this Issue open until I have an answer. If its valid, then we only need a little check which function to execute either jsontomanyresources or jsontoresource.
It turns out that a List of Objects can not only occur in JSON-List notation but also in JSON-Object notation. JSON-Object notation gets serialized into a map object, which has no map function. I suggest using the forEach function.
Fixed with PR #19