Skip to content
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

Strict parsing not as strict as it should be #499

Closed
GoogleCodeExporter opened this issue Mar 19, 2015 · 5 comments
Closed

Strict parsing not as strict as it should be #499

GoogleCodeExporter opened this issue Mar 19, 2015 · 5 comments

Comments

@GoogleCodeExporter
Copy link

According to the docs, in strict parsing "Names that are unquoted" should throw 
an error, however the following code parses the json perfectly fine, although 
lenient is false:
new JsonParser().parse("{invalid: 1}");

I am using gson-2.1.

Original issue reported on code.google.com by [email protected] on 29 Jan 2013 at 10:45

@vkopichenko
Copy link

vkopichenko commented Jul 5, 2019

Here is a workaround from #1208 for Gson strict parsing with many details and extensive test case: https://stackoverflow.com/questions/43233898/how-to-check-if-json-is-valid-in-java-using-gson/47890960#47890960

@Marcono1234
Copy link
Collaborator

This has been solved in Gson version 2.11.0 with the new Strictness API, but requires explicit opt-in, see #372 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants