Jackson vs. Gson vs. JSON-B | Annotations comparison

In this article, we will compare Jackson vs. Gson vs. JSON-B [JSR-367] on basis of annotations provides by libraries.

For in depth feature comparison, refer this article.

Jackson vs. Gson vs. JSON-B vs. JSON-P vs. org.JSON vs. Jsonpath | Java JSON libraries features comparison

Feature based Annotations comparison

This comparison is purely based on features provided through annotations. Some of these features might be possible through other means other than annotations with the help of custom code.

Feature Jackson Gson JSON-B
Property name @JsonProperty @SerializedName @JsonbProperty
Ignore / expose property @JsonIgnore
@Expose @JsonbTransient
Custom Serializer / Deserializer @JsonSerialize
@JsonAdapter @JsonbTypeAdapter
Versioning @Since
Property Order @JsonPropertyOrder @JsonbPropertyOrder
Custom object instantiation @JsonCreator @JsonbCreator
Null / Empty handling @JsonInclude
Value formatting @JsonFormat
(Date, Enum, Collection)
Access level Visibility strategy @JsonAutoDetect @JsonbVisibility
Polymorphic type handling @JsonTypeInfo
Inject values @JacksonInject
Identity based serialization @JsonIdentityInfo
Many views of same JSON @JsonView
Include instance properties in parent object @JsonUnwrapped
Raw value serialization @JsonRawValue


Leave a Reply

Your email address will not be published. Required fields are marked *