January 16, 2025

Post Image

JSON Serialization - How to Preserve the Type with Jackson

Learn how to preserve type information during JSON serialization and deserialization using Jackson. This guide explains best practices, including the use of @JsonTypeInfo and enabling default typing, to maintain object structure while working with polymorphic types in Java. Read More
by Phee Jay

March 04, 2017

Post Image

Java - Deep Copy Java Objects through Serialization

When it comes to deep copy or cloning an object, the first thing that comes to mind is to override the clone() method and set each field manually. This can be pretty cumbersome to implement for complex objects or if you have to do this for a lot of them. Read More
by Phee Jay

February 17, 2017

Post Image

Jackson - JSON Property Name Customization in Jackson using PropertyNamingStrategy

Jackson is one of the most popular java libraries for serialization/deserialization of POJOs to/from JSON. By default, Jackson derives the JSON element names from the getter/setter method names of the POJO. e.g. getActorName() is translated to actorName in the resulting JSON. Read More
by Phee Jay