-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JsonReader consumes/skips-over trailing content in input stream #18
Comments
Its the |
Which is a bug, do you agree? |
I'm not sure if this has to be classified as bug. It's rather undefined behavior as the specification does not make any guarantees. It actually doesn't say anything about how many bytes/characters are read. But this behavior was definitely unexpected by me. And it prevents several use cases where someone wants to read additional data from the same stream. As there is also no information about how many bytes/character have been read, it is also not trivial to work around this by using a |
Regardless of whether the spec does or doesn't make any guarantees, this behaviour is almost certainly not by design and seems to be, as you describe, an unanticipated side-effect of the implementation of |
The JsonReader seems to be greedy, in that it consumes any content after the first JSON value it finds in the input stream. E.g., in the following example, the trailing " 0" content is skipped over.
Is this intentional? It would seem more logical to either not consume the trailing content, or to throw a parsing exception.
The text was updated successfully, but these errors were encountered: