Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

License Build Status Maven Central

atbash-json-smart

Small library capable of converting Java instances to JSON and back, for Java 7 based on JSON Smart v2.

With the standardization of this functionality in JSON-B, it advised to use a JSON-B implementation when using Java 8.

Requirements

Runs on JDK 7, JDK 8 and JDK 11 ClassPath.

On JDK 11 there are issues with some Locale for Date parsing.

Configuration

Add artifact to pom.xml file.


<dependency>
    <groupId>be.atbash.json</groupId>
    <artifactId>octopus-json-smart</artifactId>
    <version>0.9.2</version>
</dependency>

Reading JSON

Converts the "<json>" string to instance of T.


T JSONValue.parse("<json>", Class<T>);

Converting to JSON

Converts the POJO T to a JSON String


String JSONValue.toJSONString(T);

Customizing JSON reading/creation

  • 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.

About

Adapted json-smart version; fast/small JSON decoder and encoder

Topics

Resources

License

Packages

No packages published

Languages

You can’t perform that action at this time.