|Number of watchers on Github||38|
|Number of open issues||0|
|Average time to close an issue||23 days|
|Average time to merge a PR||3 days|
|Open pull requests||1+|
|Closed pull requests||5+|
|Last commit||about 2 years ago|
|Repo Created||over 6 years ago|
|Repo Last Updated||over 2 years ago|
|Organization / Author||hubspot|
|Do you use jackson-datatype-protobuf? Leave a review!|
|View on github|
|Fresh, new opensource launches 🚀🚀🚀|
Software engineers: It's time to get promoted. Starting NOW! Subscribe to my mailing list and I will equip you with tools, tips and actionable advice to grow in your career.
Jackson module that adds support for serializing and deserializing Google's Protocol Buffers to and from JSON.
To use module on Maven-based projects, use following dependency:
<dependency> <groupId>com.hubspot.jackson</groupId> <artifactId>jackson-datatype-protobuf</artifactId> <version><!-- see table below --></version> </dependency>
There are separate versions based on which version of Jackson you are using, as well as which version of protobuf (proto2 vs. proto3). The follow table shows which version to use based on these factors:
|Jackson <= 2.6.x||Jackson 2.7.x||Jackson 2.8.x||Jackson 2.9.x|
As noted above, if you are using Protobuf3 there is a separate version of the library to use. It has support for all of the Protobuf 3 features and built-in types. The JSON representation should match the encoding specified here, with a few exceptions:
Anyobjects don't have any special handling, so the value will be a base64 string, and the type URL field name is
Compared to Protobuf2 behavior, the main difference is that field presence is only supported for
Message fields. This means we can't tell if a primitive field was explicitly set to its default value, or not set at all. So for Protobuf3 messages, the library will write primitive fields that are set to default values. If you want to disable this, you can set your JSON inclusion to
Include.NON_DEFAULT. Currently you need to set this inclusion globally, but we could make it more granular in the future.
Registration is done as follows:
ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new ProtobufModule());
after which functionality is available for all normal Jackson operations.