protobuf-javascript icon indicating copy to clipboard operation
protobuf-javascript copied to clipboard

Protobuf message from JSON in javascript

Open cyberco opened this issue 4 years ago • 2 comments

In python/C#/C/Go/... generated code it is possible to create a proto message instance from JSON. E.g. in Python where you can just do google.protobuf.json_format.Parse(json, message). I would expect the [JavaScript generated code (here and here) to offer the same, but unfortunately this is not the case.

I am currently sending my JSON in a Struct and receiving the same back. So now I want to upack that Struct and get the message back. But I don't know how.

cyberco avatar Jul 06 '20 19:07 cyberco

+1

Fanoid avatar Jun 09 '22 06:06 Fanoid

Struct has to/fromJavascript methods to help with this. However, we don't have a general solution for proto3 JSON in this runtime.

dibenede avatar Sep 09 '22 22:09 dibenede