2

I need to send data of nested JSON object from gRPC-web to Backend Golang server. I ended up with converting and sending JSON as a string to the backend server and converting the string back to the JSON in the backend server. Is this a good practice or is there any other solution to transfer JSON.

Tony King
  • 51
  • 1
  • 7
  • Why not use protobuf instead of JSON? – hutabalian Jul 11 '19 at 10:06
  • 1
    I am getting data as JSON from the third party API. Also, I am storing the same in MongoDB. So if I use protobuf, I need to Convert JSON to protobuf and also protobuf to JSON. – Tony King Jul 11 '19 at 13:40
  • Just to clarify, your Golang server is gRPC-based? May we see the `proto` file where you're defining your gRPC service and protocol buffer messages? – zmike Jul 12 '19 at 15:11
  • ` syntax = "proto3"; package pb; message DemoRequest { string json = 1; } message DemoResponse { string message = 1; } service DemoService { rpc Demo(DemoRequest) returns (DemoResponse) ; } ` – Tony King Jul 16 '19 at 06:53

0 Answers0