Skip to content
/ joy Public

Joy is yet another implementation of Jakarta JSON Processing API (JSON-P)

License

Notifications You must be signed in to change notification settings

leadpony/joy

Repository files navigation

Joy

Apache 2.0 License Maven Central Javadocs Build Status

Joy is yet another implementation of Jakarta JSON Processing API (JSON-P).

Key Features

Getting Started

Joy version 2

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

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>

Beyond the Standard API

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.

JsonGenerator

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.

YAML Support

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.

Additional Resources

Building from Source

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

Other Solutions

There are other implementations compatible with this software.

Copyright Notice

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