Apache Johnzon™

Apache Johnzon is an implementation of the Jakarta JSON Processing (JSON-P 2.1) and JSON Binding (JSON-B 3.0) specifications: a streaming parser and generator, an object mapper, and integrations for JAX-RS and WebSocket.

A Top Level Project of the Apache Software Foundation since 2014, released under the Apache License, Version 2.0.

Quickstart

Most projects want johnzon-jsonb. It implements the standard Jakarta JSON-B API and pulls the mapper and the core parser with it. Add it together with the Jakarta API jars:

<dependency>
  <groupId>org.apache.johnzon</groupId>
  <artifactId>johnzon-jsonb</artifactId>
  <version>2.2.0</version>
</dependency>
<dependency>
  <groupId>jakarta.json</groupId>
  <artifactId>jakarta.json-api</artifactId>
  <version>2.1.3</version>
</dependency>
<dependency>
  <groupId>jakarta.json.bind</groupId>
  <artifactId>jakarta.json.bind-api</artifactId>
  <version>3.0.0</version>
</dependency>
try (Jsonb jsonb = JsonbBuilder.create()) {
    String json = jsonb.toJson(order);
    Order back = jsonb.fromJson(json, Order.class);
}

In a Jakarta EE server the API jars are already there, so mark them provided or drop them. Apache TomEE ships Johnzon as its default JSON provider.

Only need parsing, without binding? johnzon-core and jakarta.json-api cover that. See Getting started for details and Gradle coordinates.

Modules

Johnzon is modular: use only the pieces you need. Each module is a single Maven artifact under the org.apache.johnzon groupId.

ModuleDescription
johnzon-coreThe JSON-P 2.1 implementation: streaming parser and generator, tree model, pointers, patches, tunable buffer strategies.
johnzon-mapperJohnzon's own object mapper: annotations, converters, adapters and access modes on top of any JSON-P implementation.
johnzon-jsonbThe JSON-B 3.0 implementation, built on the mapper, with Johnzon-specific tuning properties and CDI integration.
johnzon-jaxrsJAX-RS message body readers and writers. Apache TomEE uses it as its default JSON provider.
johnzon-websocketEncoders and decoders integrating JSON-P, the mapper and JSON-B with the Java WebSocket API (JSR 356).
extrasJSON Schema validation, JSON Logic evaluation, JSON-B extensions and OSGi JAX-RS whiteboard integration.

Versions

LineNamespaceImplementsPlatformStatus
2.xjakarta.*JSON-P 2.1, JSON-B 3.0Jakarta EE 10+Current
1.3.xjavax.*JSON-P 1.1, JSON-B 1.0Java EE 8Maintenance
1.0.xjavax.*JSON-P 1.0Java EE 7End of life

1.2.x artifacts are also published with a jakarta classifier via bytecode transformation. All releases on the download page.