-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 not strict about JSON document consumption #835
Comments
If you are passing a The implementation of JsonReader jsonReader = newJsonReader(json);
Object object = fromJson(jsonReader, classOfT);
assertFullConsumption(object, jsonReader);
return object; In the case where you are the one creating the |
Oh, yes, I should have dug one step deeper into that. Thanks. Makes sense. |
This was referenced Jun 10, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Say I have a class:
final class MyType {}
and a
TypeAdapter
:Note the missing
in.endObject()
call.My calling code:
The above will correctly fail (
JsonIOException: JSON document was not fully consumed.
).However, using a
JsonReader
instead (gson.fromJson(new JsonReader(stringReader), MyType.class)
) will not fail.Is this working as intended?
The text was updated successfully, but these errors were encountered: