Joy is yet another implementation of Jakarta JSON Processing API (JSON-P).
- Fully compliant with the latest specification of Jakarta JSON Processing API.
- Passes more than 2,000 tests provided by JSON-P Test Suite.
- Works perfect with Jakarta JSON Binding API (JSON-B).
- Supports YAML parsing and reading with the help of snakeyaml-engine.
- Supports Java 8 and higher.
- Can be used as a modular jar in Java 9 and higher.
Joy version 2 is an implementation of Jakarta JSON Processing API version 2.x, which is now defined in the jakarta.json
package instead of javax.json
package.
For using this version, the following 2 dependencies neeed to be added in your pom.xml
as an API and its implementation, respectively.
<dependency>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.leadpony.joy</groupId>
<artifactId>joy-classic</artifactId>
<version>2.1.0</version>
<scope>runtime</scope>
</dependency>
Joy version 1 is an implementation of Jakarta JSON Processing API version 1, which was defined in javax.json
package. For using this version, the following 2 dependencies neeed to be added in your pom.xml
as an API and its implementation, respectively.
<dependency>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
<version>1.1.6</version>
</dependency>
<dependency>
<groupId>org.leadpony.joy</groupId>
<artifactId>joy</artifactId>
<version>1.3.0</version>
<scope>runtime</scope>
</dependency>
For using the provider-specific API shown below, scope
element of dependency
must be changed from runtime
to compile
or be removed entirely.
The provider-specific API is available in org.leadpony.joy.api
package.
The following configuration properties are added.
-
INDENTATION_SIZE
Specifies the number of spaces to be used as an indentation. The value of the property must be an integer. By default the number is 4.
-
TAB_INDENTATION
Uses a tab for indentation instead of spaces. The value of the property could be anything.
All you need to do for parsing/reading YAML documents is switching the implementation from joy-classic
to joy-yaml
as shown below:
<dependency>
<groupId>org.leadpony.joy</groupId>
<artifactId>joy-yaml</artifactId>
<version>2.1.0</version>
<scope>runtime</scope>
</dependency>
Please note that there are some restrictions in the current implementation of joy-yaml
.
- Aliases are not supported and cause the parser/reader to throw an exception.
- Anchors are silently ignored.
- Multiple documents are not supported.
- Both generating and writing YAML documents are not supported yet.
JDK 14 and Maven are the tools required to build this software. The following command builds and install it into your local Maven repository.
mvn clean install -P release
There are other implementations compatible with this software.
- Jakarta JSON Processing (Reference Implementation)
- Apache Johnzon
Copyright 2019-2021 the original author or authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this product except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0