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

jsonv2.Marshal with jsonv1.DefaultOptionsV1 not equivalent to jsonv1 #16

Closed
gazerro opened this issue Oct 14, 2023 · 3 comments
Closed

Comments

@gazerro
Copy link

gazerro commented Oct 14, 2023

jsonv2.Marshal(in, jsonv1.DefaultOptionsV1()) should be semantically equivalent to jsonv1.Marshal(in), but the former returns an error in the following cases

  • a struct has only unexported fields
  • an exported field has a non-ignored json tag

Also, the former clears the value when unmarshaling a JSON null into a non-nullable type.

@dsnet
Copy link
Collaborator

dsnet commented Oct 14, 2023

That is all expected at the moment. We haven't implemented all of the v1 compatibility layer. It will be a gradual process to get to 100% backwards compatibility.

@gazerro
Copy link
Author

gazerro commented Oct 14, 2023

@dsnet In this case, feel free to close this issue. Thanks.

@dsnet
Copy link
Collaborator

dsnet commented Nov 20, 2024

Closing as we'll be addressing each v1 feature one-by-one.

@dsnet dsnet closed this as completed Nov 20, 2024
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

2 participants