j4rs uses (de)serialization to achieve interoperation between the Rust and Java worlds and handle custom objects (more details here).
In the Rust world, this is achieved using serde and in the Java world using jackson.
For the Java world, in case jackson is not enough, or you just prefer using some other serialization library, j4rs offers the ability to replace the serializer using Java's Service Provider Interface.
To do this, you should just provide an implementation of the Codec interface (provided by the j4rs jar) and declare this implementation in a file with the name org.astonbitecode.j4rs.api.services.json.Codec, inside your Java library. The file should just contain the implementation class name.
You may find an example in the j4rs-java-call-rust repository (service file in META-INF).
Note: The hash (#) in the start of the line is a comment and should not be there in your real implementation. Only the class name should be there.
Finally, if you want to reduce your library's size, you you may exclude the jackson transitive dependencies of j4rs.
This was implemented in the context of issue #62