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

Support returning non-critical warnings when decoding #570

Open
luxas opened this issue Aug 30, 2021 · 0 comments
Open

Support returning non-critical warnings when decoding #570

luxas opened this issue Aug 30, 2021 · 0 comments

Comments

@luxas
Copy link

luxas commented Aug 30, 2021

Hi! Thanks for this great project 🥇 💯

When decoding JSON, sometimes you just want to inform the users about problems in the serialized content, rather than returning an error or staying silent. I realize that the Attachment field of https://pkg.go.dev/github.com/json-iterator/go#Iterator could be used for this purpose (thanks for adding that in advance!) by a custom warning-supporting decoder, but it would be nice to add this field specifically for this purpose, so it could be re-used more generally.

The two main uses I see for it would be to warn instead of error when there are duplicate or unknown fields when decoding.
I can make a PR with this change if accepted. Would you be open to this?

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

1 participant