9

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.

0

1 Answer 1

1

You actually have a library called protobuf.js and you can try it out with ObjectInformationType.fromObject(JSON.parse(msg)).

It parses the JSON object into protobuf.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! Yes, but than I would have to combine both the Google JS library and protobuf.js. Not sure how that would work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.