com.holon-platform.json:holon-jackson

Holon JSON support using Jackson

License

License

Categories

Categories

JSON Data Jackson ORM
GroupId

GroupId

com.holon-platform.json
ArtifactId

ArtifactId

holon-jackson
Last Version

Last Version

5.5.0
Release Date

Release Date

Type

Type

jar
Description

Description

com.holon-platform.json:holon-jackson
Holon JSON support using Jackson
Project URL

Project URL

https://holon-platform.com
Project Organization

Project Organization

The Holon Platform

Download holon-jackson

How to add to project

<!-- https://jarcasting.com/artifacts/com.holon-platform.json/holon-jackson/ -->
<dependency>
    <groupId>com.holon-platform.json</groupId>
    <artifactId>holon-jackson</artifactId>
    <version>5.5.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.holon-platform.json/holon-jackson/
implementation 'com.holon-platform.json:holon-jackson:5.5.0'
// https://jarcasting.com/artifacts/com.holon-platform.json/holon-jackson/
implementation ("com.holon-platform.json:holon-jackson:5.5.0")
'com.holon-platform.json:holon-jackson:jar:5.5.0'
<dependency org="com.holon-platform.json" name="holon-jackson" rev="5.5.0">
  <artifact name="holon-jackson" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.holon-platform.json', module='holon-jackson', version='5.5.0')
)
libraryDependencies += "com.holon-platform.json" % "holon-jackson" % "5.5.0"
[com.holon-platform.json/holon-jackson "5.5.0"]

Dependencies

compile (5)

Group / Artifact Type Version
com.holon-platform.json : holon-json jar 5.5.0
com.fasterxml.jackson.core : jackson-core jar 2.11.1
com.fasterxml.jackson.core : jackson-annotations jar 2.11.1
com.fasterxml.jackson.core : jackson-databind jar 2.11.1
com.fasterxml.jackson.datatype : jackson-datatype-jsr310 jar 2.11.1

test (3)

Group / Artifact Type Version
ch.qos.logback : logback-classic jar 1.2.3
org.junit.jupiter : junit-jupiter-api jar 5.6.2
org.junit.jupiter : junit-jupiter-engine jar 5.6.2

Project Modules

There are no modules declared in this project.

Holon platform JSON module

Latest release: 5.5.0

This is the JSON module of the Holon Platform, which provides support for the JSON data-interchange format using the must popular serialization and deserialization libraries:

The module main features are:

  • A simple JSON objects serialization and deserialization API, to use concrete JSON parsers implementation in a easier and abstract way, providing also useful helper methods for Collections and PropertyBox types serialization and deserialization.
  • JSON serialization and deserialization support for the PropertyBox platform foundation data container class.
  • JAX-RS configuration and auto-configuration support to enable Gson as default JSON type messages serialization and deserialization engine with PropertyBox support and to enable PropertyBox serialization and deserialization when using Jackson as default provider.
  • Full support of the Java 8 date and time API: the java.time.* data types serialization and deserialization is supported and enabled out-of-the-box.
  • The ISO-8601 format is used by default to serialize the java.util.Date data types.
  • Spring support to configure PropertyBox serialization and deserialization in RestTemplate JSON message converters.
  • Spring Boot support to auto-configure Gson and ObjectMapper instances with PropertyBox serialization and deserialization capabilities.

See the module documentation for details.

Just like any other platform module, this artifact is part of the Holon Platform ecosystem, but can be also used as a stand-alone library.

See Getting started and the platform documentation for further details.

At-a-glance overview

JSON API - serialization:

Json json = Json.require();

JsonWriter result = json.toJson(myObject);
String asString = result.asString(); 
byte[] asBytes = result.asBytes(); 
result.write(new StringWriter()); 
		
asString = json.toJsonString(myObject);

JSON API - deserialization:

Json json = Json.require();

MyObject result = json.fromJson("JSON string", MyObject.class);
		
result = json.fromJson(JsonReader.from(new StringReader("JSON string")), MyObject.class);

JSON API - Property model:

StringProperty NAME = StringProperty.create("name");
StringProperty SURNAME = StringProperty.create("surname");
PropertySet<?> PROPERTY_SET = PropertySet.of(NAME, SURNAME);
		
PropertyBox propertyBox = PropertyBox.builder(PROPERTY_SET).set(NAME, "John").set(SURNAME, "Doe").build();
		
Json json = Json.require();
		
String jsonValue = json.toJson(propertyBox).asString();
PropertyBox result = json.fromJson(jsonValue, PROPERTY_SET);

JSON API - Provider:

// Using Jackson
Json jsonApi = JacksonJson.create();
		
// Using Gson
Json jsonApi = GsonJson.create();

Jackson - Property model support:

ObjectMapper mapper = JacksonConfiguration.mapper();
// serialize
PropertyBox propertyBox = PropertyBox.builder(PROPERTY_SET).set(NAME, "John").set(SURNAME, "Doe").build();
String json = mapper.writer().writeValueAsString(propertyBox);
// deserialize
PropertyBox value = PROPERTY_SET.execute(() -> mapper.reader().forType(PropertyBox.class).readValue(json));

Gson - Property model support:

Gson gson = GsonConfiguration.builder().create();
// serialize
PropertyBox propertyBox = PropertyBox.builder(PROPERTY_SET).set(NAME, "John").set(SURNAME, "Doe").build();
String json = gson.toJson(propertyBox);
// deserialize
PropertyBox value = PROPERTY_SET.execute(() -> gson.fromJson(json, PropertyBox.class));

See the module documentation for the user guide and a full set of examples.

Code structure

See Holon Platform code structure and conventions to learn about the "real Java API" philosophy with which the project codebase is developed and organized.

Getting started

System requirements

The Holon Platform is built using Java 8, so you need a JRE/JDK version 8 or above to use the platform artifacts.

Releases

See releases for the available releases. Each release tag provides a link to the closed issues.

Obtain the artifacts

The Holon Platform is open source and licensed under the Apache 2.0 license. All the artifacts (including binaries, sources and javadocs) are available from the Maven Central repository.

The Maven group id for this module is com.holon-platform.json and a BOM (Bill of Materials) is provided to obtain the module artifacts:

Maven BOM:

<dependencyManagement>
    <dependency>
        <groupId>com.holon-platform.json</groupId>
        <artifactId>holon-json-bom</artifactId>
        <version>5.5.0</version>
        <type>pom</type>
        <scope>import</scope>
    </dependency>
</dependencyManagement>

See the Artifacts list for a list of the available artifacts of this module.

Using the Platform BOM

The Holon Platform provides an overall Maven BOM (Bill of Materials) to easily obtain all the available platform artifacts:

Platform Maven BOM:

<dependencyManagement>
    <dependency>
        <groupId>com.holon-platform</groupId>
        <artifactId>bom</artifactId>
        <version>${platform-version}</version>
        <type>pom</type>
        <scope>import</scope>
    </dependency>
</dependencyManagement>

See the Artifacts list for a list of the available artifacts of this module.

Build from sources

You can build the sources using Maven (version 3.3.x or above is recommended) like this:

mvn clean install

Getting help

Examples

See the Holon Platform examples repository for a set of example projects.

Contribute

See Contributing to the Holon Platform.

Gitter chat Join the contribute Gitter room for any question and to contact us.

License

All the Holon Platform modules are Open Source software released under the Apache 2.0 license.

Artifacts list

Maven group id: com.holon-platform.json

Artifact id Description
holon-json Holon JSON objects serialization and deserialization core API
holon-gson Base Gson configuration for PropertyBox serialization and deserialization support
holon-gson-jaxrs JAX-RS configuration support to use Gson as JSON type messages serializer/deserializer
holon-gson-spring Spring RestTemplate configuration and Gson Spring Boot auto-configuration
holon-jackson Base Jackson configuration for PropertyBox serialization and deserialization support
holon-jackson-jaxrs JAX-RS configuration support for Jackson to enable PropertyBox serialization and deserialization in JSON format
holon-jackson-spring Spring RestTemplate configuration and ObjectMapper Spring Boot auto-configuration
holon-json-bom Bill Of Materials
holon-json-bom-platform Bill Of Materials with external dependencies
documentation-json Documentation
com.holon-platform.json

Holon Platform

The Holon Platform is a Java development ecosystem to create and maintain high quality, enteprise-grade web applications and services.

Versions

Version
5.5.0
5.4.0
5.3.0
5.2.3
5.2.2
5.2.1
5.2.0
5.2.0-rc2
5.2.0-rc1
5.2.0-alpha2
5.2.0-alpha1
5.1.2
5.1.1
5.1.0
5.0.4
5.0.3
5.0.2
5.0.1
5.0.0