-
Notifications
You must be signed in to change notification settings - Fork 15.6k
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
Why uint64, int64 Protobuf-Type be serialize as String JSON-Type in MessageToJsonString()? #2679
Comments
That's the spec for the protobuf json format: https://developers.google.com/protocol-buffers/docs/proto3#json Someone will have to confirm, but I believe the reason is in javascript, some browser can't handle a full 64bit value as a number, so the only way to ensure they can work for those clients is to handle them as strings. |
@thomasvl Oh I see, this is a Javascript precision problem that mentioned in some article, thank you very much. |
Why uint64, int64 Protobuf-Type be serialize as String JSON-Type in MessageToJsonString()?
I tried to use uint64 or int64 to save the Timestamp, and convert it to JSON by MessageToJsonString()
Here is a sample output:
that timestamp is int64 or uint64 and nanosecond is int32 Protobuf-Type. Why a 64-bits integer be serialized as String type? Is there any JsonOptions was discussed to support 64-bits integer to JSON integer conversion?
The text was updated successfully, but these errors were encountered: