Is “google/protobuf/struct.proto” the best way to send dynamic JSON over GRPC?

前端 未结 3 476
暗喜
暗喜 2021-02-13 17:14

I have a written a simple GRPC server and a client to call the server (both in Go). Please tell me if using golang/protobuf/struct is the best way to send a dynamic JSON with GR

3条回答
  •  走了就别回头了
    2021-02-13 17:37

    If you have JSON data already, you could also choose to encode it as a string field. Otherwise, using a google.protobuf.Struct seems pretty reasonable, and you should be able to use jsonpb to convert between the Struct and JSON easily on the client and server.

提交回复
热议问题