Perfect Java serialization to and from JSON format (available on Maven Central). To include in your project:
<dependency> <groupId>com.cedarsoftware</groupId> <artifactId>json-io</artifactId> <version>4.12.0</version> </dependency>
json-io consists of two main classes, a reader ( json-io does not require that Java classes implement
JsonReader) and a writer (
JsonWriter). json-io eliminates the need for using
ObjectInputStream / ObjectOutputStream to serialize Java and instead uses the JSON format.
Externalizable to be serialized, unlike the JDK's
ObjectOutputStream. It will serialize any Java object graph into JSON and retain complete graph semantics / shape and object types. This includes supporting private fields, private inner classes (static or non-static), of any depth. It also includes handling cyclic references. Objects do not need to have public constructors to be serialized. The output JSON will not include
transient fields, identical to the ObjectOutputStream behavior.json-io does not depend on any 3rd party libraries, has extensive support for Java Generics, and allows extensive customization.
json-io does not require that Java classes implement