Skip to content

pustike/pustike-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pustike JSON

Contains ObjectMapper class that can create Java objects from JSON or create JSON value from Java objects, by using Jakarta JSON-P APIs internally.

The key feature of this object mapper is its ability to generate JSON values with only specified list of fields/properties of an object depending on the given context. For ex, when a list of customer objects are being shown in a select field, very few properties like code and name, are required. But when editing the same customer object, many additional properties are needed which can be defined in another context. This helps in reducing the transferred data size when communicating with JSON objects in the API.

Following are some of its features:

  • Read JSON text and convert it to the given type.
  • Convert an object to JsonValue, optionally in the given context to include listed fields only.
  • @JsonIncludes allows multiple contexts to be defined on a class with each of them listing fields to be included in JSON format.
  • A TypeConverter utility class to convert objects between given source and target types.

Dependencies

This library requires Java 17 and following modules:

Group Id Artifact Id Version
jakarta.json jakarta.json-api 2.1.2

Documentation: Latest javadocs is available here.

Download

To add a dependency using Maven, use the following:

<dependency>
    <groupId>io.github.pustike</groupId>
    <artifactId>pustike-json</artifactId>
    <version>0.3.0</version>
</dependency>

Or, download the latest JAR(~21kB) from Maven Central.

License

This library is published under the Apache License, Version 2.0