You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
with proto3, protocol buffers now have a standard json format, is there a way to leverage this with this library?
my use case is caching protocol buffers in local storage. currently i've been base64 encoding the messages before storing them. this becomes more complex with the Map type.
@dcodeIO Sorry, it's not clear to me - is the issue closed because any changes discussed here are no longer relevant (due to rewrite) or because protobuf.js 6.x now supports the functionality?
Activity
dcodeIO commentedon Nov 18, 2015
Have you tried Message#encodeJSON?
lanttu commentedon Dec 16, 2015
The method doesn't seem to use canonical proto3 JSON encoding as specfied in here: https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json
joeblew99 commentedon Dec 17, 2015
Did you sort out if Google's support for json, makes bufferjs redundant ?
I suspect that bufferjs allows marshalling between json and PB client side, and grpc allows marshalling between the two server side at the facade.
I would like to know what the answer to this is from an architectural perspective.
leeyeh commentedon Feb 23, 2016
+1.
My use case is to encode to and decode from the canonical formatted JSON data, since React Native's js-native bright is text-based.
dcodeIO commentedon Nov 28, 2016
Closing this for now.
protobuf.js 6.0.0
Feel free to send a pull request if this is still a requirement.
aidansteele commentedon Apr 11, 2017
@dcodeIO Sorry, it's not clear to me - is the issue closed because any changes discussed here are no longer relevant (due to rewrite) or because protobuf.js 6.x now supports the functionality?
dcodeIO commentedon Apr 11, 2017
Not quite, but the default toJSON implementation of message instances should be close.
Not yet supported:
"NaN", "Infinity" strings for floatsFeel free to reopen!
New: Added 'json' conversion option for proto3 JSON mapping compatibi…
dcodeIO commentedon Apr 11, 2017
Related: #677