Fantastic JSON-B Libs and Where to Find Them
JSON-B is a Jakarta EE specification that provides an API for transforming JSON to Java objects (and back again). The following libraries are implementations of this API, and are used in compliant application servers and frameworks:
Eclipse Yasson (reference implementation)
- Wildfly (23.0.0.Final)
- Payara (5.2021.1)
- OpenLiberty (21.0.0.3)
- Quarkus (1.13.2.Final)
- Helidon (2.2.2)
- TomEE (8.0.6)
To find out which implementation is used, it is sufficient to inspect the package name of the following class:
JsonbBuilder.create().getClass()
FasterXML Jackson is not an implementation of the JSON-B specification, but provides similar mapping functionality between JSON and Java objects. The detailed mapping behavior of Jackson and JSON-B implementations differs, which is why Quarkus and Wildfly allow you to select what you want in the context of REST services:
- Wildfly: By explicitly setting the system property
resteasy.preferJacksonOverJsonB
totrue
orfalse
. If this property is not set, Wildfly will automatically use Jackson as soon as it finds Jackson-specific annotations somewhere inside your deployment (which may not be what you want, indicated by the startup warning WFLYRS0018). - Quarkus: By choosing the appropriate Maven dependency.