Java: JSON -> Protobuf & back conversion

后端 未结 9 2042
隐瞒了意图╮
隐瞒了意图╮ 2020-12-02 10:59

I have an existing system, which is using protobuf-based communication protocol between GUI and server. Now I would like to add some persistence, but at the moment

9条回答
  •  [愿得一人]
    2020-12-02 11:54

    We are currently using protobuf-java-format to convert our Protobuf messages (anything subclass of Message) into a JSON format to send over our web API.

    Simply do:

      JsonFormat.printToString(protoMessage)
    

提交回复
热议问题