Reputation: 395
All I have is raw protobuf binary data, I don't have access to .proto file, and I need to convert it to json string in Java. So is there is a way to do that in java? i.e. something similar to protoc tool
Upvotes: 1
Views: 7592
Reputation: 1064044
This won't be possible without the .proto schema. For multiple reasons:
So: there is simply no good and reliable way of understanding data without the schema, let alone choosing how to display it as JSON.
Upvotes: 4
Reputation: 2142
.proto
file is basically schema of your proto buffer.
protoc.exe
tool is used for generating the files (i.e. used for creating the proto buffer by providing setter and getters methods.)
yes their is available some methods which convert the protobuffer
into JSON
like i am using protobuffer
in c++ and it provide some methods to convert it into JSON.
same also will be available in Java as well. so don't mix protoc
tool concept with this 'data format conversion'
try to use this api provided by Protobuffer offical
https://developers.google.com/protocol-buffers/docs/reference/java/
https://developers.google.com/protocol-buffers/docs/reference/java/
Hope it will help
Upvotes: 0