You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
User has to implement UnmarshalerJSONArray interface consisting of a single function UnmarshalJSONArray which is called on each element of a collection.
Provided example for a slice (where user can simply append each new element to receiver):
This is probably the best way, but it makes me think we could add a Index() method on the decoder which would return the current index of the array being decoded.
There is a section in docs https://github.com/francoispqt/gojay#arrays-slices-and-channels describing how to decode JSON object to a slice, an array or a channel with examples for a slice and a channel.
User has to implement
UnmarshalerJSONArray
interface consisting of a single functionUnmarshalJSONArray
which is called on each element of a collection.Provided example for a slice (where user can simply append each new element to receiver):
The problem with an array is that there is no (or is there?) way to get current index of unmarshalled array element.
Of course user can maintain this index himself:
Is this the suggested way or i'm missing more elegant/concise/idiomatic solution?
The text was updated successfully, but these errors were encountered: