-
Notifications
You must be signed in to change notification settings - Fork 15.5k
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
JsonStringToMessage fail if there is "bytes" member in proto file #5719
Comments
If I change the proto member "msg_id" 's type from bytes to uint32, it will execute success。 thank you very much :-) |
I use MessageToJsonString first to see what is the real output when set msg_id to "1"
I think this is a special mechanism in the protobuf when convert string to bytes If I want to implement this special mechanism by my self without using protobuf. i.e. I can generate acceptable Json message byte string (from byte[]) which can let JsonStringToMessage() pass. thank you :-) |
After further study, I realize the encode which protobuf used for bytes is base64 I think this is not bug, so I will go to close this issue, thank you |
If string directly converts to proto bytes , could the result be error? |
What version of protobuf and what language are you using?
Version: v3.6.1
Language: C++
What operating system (Linux, Windows, ...) and version?
Ubuntu 1404.5
What runtime / compiler are you using (e.g., python version or gcc version)
g++ 4.8.4
What did you do?
Steps to reproduce the behavior:
What did you expect to see
If everything OK, we will see "parse ok, id: 1"
What did you see instead?
I see error "Failed to parse msg from json"
error_example.zip
The text was updated successfully, but these errors were encountered: