-
Notifications
You must be signed in to change notification settings - Fork 76
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
JSON serialization options #737
Comments
Hey Nicole, when parsing an enum value from JSON, the full enum value name or the integer value are both accepted. So for the Protobuf There isn't a JsonReadOption for it because both forms must be accepted to interop with other Protobuf implementations. If you serialize to JSON, you need to make a choice, so it is available as a JsonWriteOption. |
Oops, @smaye81 just pointed out I'm, wrong. Yes, the docs for "JSON serialization options" are swapped. Thanks for letting us know, @nicole0707. |
Fixes #737 This fixes the JSON serialization docs to list options for the correct methods.
From the docs https://github.com/bufbuild/protobuf-es/blob/main/docs/runtime_api.md#json-serialization-options,
Message.fromJson
is supposed to allow some option likeenumAsInteger
.However,
JsonReadOptions
seems to include different options from code https://github.com/bufbuild/protobuf-es/blob/main/packages/protobuf/src/json-format.ts#L86.Just wondering if the doc is out of date, is there any recommended way to support these options with
fromJSON
?Cheers.
The text was updated successfully, but these errors were encountered: