In order to use Java API for JSON Binding (JSON-B), I have found it necessary to include the following three dependencies in my Maven POM:
<!-- https://mvnrepository.com/artifact/jakarta.json.bind/jakarta.json.bind-api -->
<dependency>
<groupId>jakarta.json.bind</groupId>
<artifactId>jakarta.json.bind-api</artifactId>
<version>1.0.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.eclipse/yasson -->
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>yasson</artifactId>
<version>1.0.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish/javax.json -->
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>1.1.4</version>
</dependency>
The first two make sense to me.
jakarta.json.bind-api
is the JSON-B API defined by JSR 367.yasson
is the reference implementation of that API, Eclipse Yasson.
➥ But what exactly does the third dependency, javax.json
from Glassfish, bring to the party? Why is it required for my app to work?
If omitted, when running Jsonb jsonb = JsonbBuilder.create();
, I get this error:
javax.json.JsonException: Provider org.glassfish.json.JsonProviderImpl not found
I am confused because I thought Yasson is my JSON processing implementation.