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
As currently documented, this is working as intended:
StackPointer returns a JSON Pointer RFC 6901 to the most recently read value. Object names are only present if AllowDuplicateNames is false, otherwise object members are represented using their index within the object.
At the point when we're processing *SubConf the first time, the last token processed was the [, so /spaces is the correct pointer to the "most recently read value", which is the nested JSON array. The second time processing *SubConf, the last token processed the }, so /spaces/0 is the correct pointer to the "most recently read value", which is the first element of the nested JSON array.
I can see why this goes against what you expect, since your intent was probably to get the pointer to the next token. We could change the semantics of StackPointer to point at the next token, but that will require a potential reading of the stream and therefore also the possibility to fail (and thus needing an error).
I think the current semantics of StackPointer is probably the right one to keep (since it also exactly matches jsontext.Encoder.StackPointer, but we could consider adding a fun (*Decoder) PeekStackPointer() (Pointer, error) method.
The following code:
produces the following output:
Is that correct ?
In particular, I would have expected to see:
/spaces/0
before/spaces/0/id
and/spaces/1
before/spaces/1/id
The text was updated successfully, but these errors were encountered: