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

Add an option to operate parser in strict mode. #902

Closed
wants to merge 1 commit into from

Conversation

chajath
Copy link

@chajath chajath commented Aug 17, 2016

I can't help but feeling that hard coding leniency setting at the top level was a mistake. However, given changing that will introduce too big a change in behavior, I propose that we introduce a separate flag to enforce strict parsing at the outermost level of the element.

@chajath
Copy link
Author

chajath commented Aug 17, 2016

This will be a workaround for #372

@swankjesse
Copy link
Collaborator

You can workaround by getting a TypeAdapter first. It doesn't do anything lenient.

@chajath
Copy link
Author

chajath commented Aug 18, 2016

Not quite sure what you mean by that. Is there any code snippet that I can look at? Workaround-able or not, we might as well offer this option to the user anyway to be more user friendly.

@JakeWharton
Copy link
Contributor

Call getAdapter with your type first and then use that TypeAdapter for
calls to toJson or fromJson.

On Wed, Aug 17, 2016 at 8:46 PM In-Ho Yi [email protected] wrote:

Not quite sure what you mean by that. Is there any code snippet that I can
look at? Workaround-able or not, we might as well offer this option to the
user anyway to be more user friendly.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#902 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAEEER8DlQU7TL8xXmkb3yIR-MKHV1Kuks5qg6tugaJpZM4Jm7Od
.

@chajath
Copy link
Author

chajath commented Aug 18, 2016

I see. I guess the workaround is relatively simple. I still think there is some value in this pull request, because this change makes it more obvious to the users what gson fromJson is doing by inspecting API of the gson builder.

I also see #804 which will make fromJson more consistent, but I guess this will introduce breaking change.

@Marcono1234
Copy link
Collaborator

This seems to be obsolete with the Strictness mode API introduced by #2437 for the next Gson version.

Thanks nonetheless for the work you have put into this!

@Marcono1234 Marcono1234 closed this Aug 4, 2023
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

Successfully merging this pull request may close these issues.

4 participants