Closed alee792 closed 6 years ago
Hi,
Your JSON is invalid in the test, but still it won't work with valid JSON.
When unmarshaling your array you are calling dec.Decode(b)
in UnmarshalJSONArray
method just change it to dec.Object(b)
and it works.
The Decode method should not be used within a unmarshaling method.
Let me know if you have any issue.
Hi there,
I'm trying to unmarshal/decode an array of objects, but I'm afraid it's either unimplemented or I'm doing something incorrectly.
Boilerplate for my struct:
Test Code:
The former passes, the latter fails:
I deviated from the docs since all of the array decoding was for standard types and used Decode. I also thought I had a possible issue using the undocumented EmbeddedJSON, but ran into the same problems when dropping that from my struct. I'm guessing that when the current chunk is finished decoding, it expects a ',', but gets the close bracket of the object instead.
Please let me know if I can provide any additional information or if I've made a glaring mistake.