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

json_format.py is converting fixed64 to string #5942

Closed
rohitsaboo opened this issue Mar 22, 2019 · 2 comments
Closed

json_format.py is converting fixed64 to string #5942

rohitsaboo opened this issue Mar 22, 2019 · 2 comments
Assignees
Labels

Comments

@rohitsaboo
Copy link

What version of protobuf and what language are you using?
Version: master/v3.6.0/v3.5.0 etc.
master

Language: C++/Java/Python/C#/Ruby/PHP/Objective-C/Javascript
Python

What operating system (Linux, Windows, ...) and version?
doesn't matter

What runtime / compiler are you using (e.g., python version or gcc version)
doesn't matter

What did you do?
See https://github.com/protocolbuffers/protobuf/blob/master/python/google/protobuf/json_format.py#L68

What did you expect to see
fixed64 and sfixed64 types are also converted to json numbers when we run json_format.

What did you see instead?
They are converted to strings.

@anandolee anandolee self-assigned this Mar 25, 2019
@anandolee
Copy link
Contributor

It is by design. for int64, fixed64 and uint64, protobuf JSON printer will print a string. Both numbers and strings are accepted in parser:
https://developers.google.com/protocol-buffers/docs/proto3#json

@rohitsaboo
Copy link
Author

Hi Jie, do you mind elaborating a bit on why this design choice was made?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants