Closed mwildehahn closed 7 years ago
Have you tried Message#encodeJSON?
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
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.
+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.
Closing this for now.
Feel free to send a pull request if this is still a requirement.
@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?
or because protobuf.js 6.x now supports the functionality
Not quite, but the default toJSON implementation of message instances should be close.
someMessage.toJSON();
// or
SomeMessage.toObject(someMessage, util.toJSONOptions);
Not yet supported:
Feel free to reopen!
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.