A safe and efficient Java serialization library that captures serialized object graphs into a structured, inspectable intermediate representation rather than an opaque byte stream.
SmallRye Serial serializes Java objects into a tree of Serialized nodes that can be
examined, transformed, or stored before being deserialized back into live objects.
It supports the full range of Java serialization mechanisms:
Serializableclasses (including customwriteObject/readObject)Externalizableclasses- Records
- Enums
- Proxies
writeReplace/readResolve- Circular and self-referencing object graphs
Add the following to the dependencies section of your pom.xml:
<dependency>
<groupId>io.smallrye.serial</groupId>
<artifactId>smallrye-serial</artifactId>
<version>VERSION</version>
</dependency>Replace VERSION with the latest release version.
Create a SerialContext, then use it to serialize and deserialize objects:
// Build a context with the default serialization providers
SerialContext ctx = SerialContext.builder()
.addDefaultProviders()
.build();
// Serialize an object into its intermediate representation
Serialized serialized = ctx.serialize(myObject);
// Deserialize back into a live object
Object restored = ctx.deserialize(serialized);The module name is io.smallrye.serial.
module my.module {
requires io.smallrye.serial;
}mvn verifyPlease refer to the SmallRye Wiki for the Contribution Guidelines.
This project is licensed under the Apache License 2.0.