4

When using the regular Java Protobuf, you can use JsonFormat from com.google.protobuf:protobuf-java-util to convert the Protobuf message to a JSON string, and back.

But does there exist a converter that works with Java Protobuf Lite? JsonFormat unfortunately supports the regular Java Protobuf messages only.

Rok Povsic
  • 4,626
  • 5
  • 37
  • 53

1 Answers1

3

Unfortunately Protobuf Java developers aren't aware of any such converter so it is likely it doesn't exist.

Rok Povsic
  • 4,626
  • 5
  • 37
  • 53
  • How did you solve this? – rupesh Aug 05 '23 at 18:12
  • @rupesh It's been a while so I don't remember the details, but I think this is the code: https://github.com/Clarifai/clarifai-java/blob/8c1a278c32f67dab7d2188c7bc0e2e62eb9f4dae/core/src/main/java/clarifai2/grpc/JsonMarshaller.java – Rok Povsic Aug 09 '23 at 10:46