Reputation: 431
I am implementing protobuf recently in our kotlin project. I am receiving the binary data and deserialising it to Proto object using the proto file.
But I would like have that converted to data class. I could not find any supporting information about how to do this.
Is it possible to get data class from binary data or from deserialized proto object??
Upvotes: 1
Views: 7696
Reputation: 385
If you have know the structure of the data and can write your data classes upfront, you might want to have a look at kotlinx.serialization. It is an official Kotlin project and supports protobuf out-of-the-box.
Upvotes: -1
Reputation: 1844
One solution might be to use pb-and-k which has the kotlin code generator and will generate data classes for you based off of the .proto
files
Upvotes: 1