Small library capable of converting Java instances to JSON and back, for Java 8, 11 and 17 inspired on JSON Smart v2.
With the standardization of this functionality in JSON-B, it advised to use a JSON-B implementation unless you are outside a Jakarta runtime and want some small and fast JSON handling.
Runs on JDK 8, JDK 11 ClassPath, and JDK 17 ClassPath.
Add artifact to pom.xml file.
<dependency> <groupId>be.atbash.json</groupId> <artifactId>octopus-json-smart</artifactId> <version>1.1.1</version> </dependency>
Converts the "<json>" string to instance of T.
T JSONValue.parse("<json>", Class<T>);
Converts the POJO T to a JSON String
- Implement the JSONAware interface
- Define custom encoders and writers with @MappedBy and custom CustomJSONEncoder, CustomBeanJSONEncoder and/or Writer.
- Define a custom Encoder which also implement JSONEncoderBuilder interface to have a builder like pattern for encoding JSON to Java.
Extend CustomBeanBuilderJSONEncoder and define it as encoder at @MappedBy.