Mahesh is right, that is the correct way. Also, I wrote the grpc-with-json article. It was meant to show how to avoid any Protobuf dependencies. If you want to use JsonFormat (which I also recommend), there is an example client and server here: https://github.com/grpc/grpc-java/tree/v1.15.0/examples/src/main/java/io/grpc/examples/advanced
On Saturday, September 29, 2018 at 3:19:23 AM UTC-7, Mahesh Kanote wrote: > > Sending again earlier link has typo error > > > https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/util/JsonFormat > > On Sat, 29 Sep 2018, 15:45 Mahesh Kanote, <[email protected] > <javascript:>> wrote: > >> Hi, >> >> I have been using this >> https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/util/Jsonformat. >> >> It is working for me to convert grpc messages to json and Jason to grpc >> message. >> >> Thanks >> >> On Sat, 29 Sep 2018, 15:02 omid pourhadi, <[email protected] >> <javascript:>> wrote: >> >>> >>> >>> Hi, >>> >>> I have a simple proto message in grpc >>> >>> message Person{ >>> int32 id = 1; >>> string firstName = 2; >>> } >>> >>> How can I convert it into Json after generating code for java language >>> and convert json to Person? >>> >>> for example : >>> >>> >>> Person.toJson(); >>> >>> {"id":, "firstName": "test"} >>> >>> Or >>> >>> Person.fromJson(json); >>> >>> let me know if there is any solution rather than >>> https://grpc.io/blog/grpc-with-json >>> >>> Thanks >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "grpc.io" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected] <javascript:>. >>> To post to this group, send email to [email protected] >>> <javascript:>. >>> Visit this group at https://groups.google.com/group/grpc-io. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/grpc-io/b8ef7c98-1eb3-4686-9006-8d8e33ef2258%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/grpc-io/b8ef7c98-1eb3-4686-9006-8d8e33ef2258%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/grpc-io. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/e4193ec6-9550-417b-b42a-ef59d528699f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
