Currently Prost does not support JSON serialization-deserialization. Although we have the almighty Serde for JSON serialization and deserialization, using
serde_derive is not possible for Prost-generated structs because representation of enumerations is different between Prost structs and Protobuf-JSON format. Prost structs represent enumerations as plain integers but Protobuf-JSON represents as text identifers so using
serde_derive won't work. This procedural macro is intended to fix the issue.
In order to use, you need a Git master branch of
prost-build which implements required methods for Prost enumerations for now. If you're using tonic_build, there is a fork for using Git version of
To see it in action, see
- Unit tests