Javatpoint Logo
Javatpoint Logo

Jackson Change Name of the Field

When we serialize a Java Object, we need to change the name of a specific field for mapping it with another JSON property. It is one of the most used and important concepts of Jackson to learn and understand.

In order to change the field name, we use the @JsonProperty annotation. In the annotation constructor, we pass the name of the property.

Let's take an example to understand how we can use @JsonProperty annotation to change the name of the field for serialization.

ChangeNameOfFieldExample.java

Output:

Jackson Change Name of the Field





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA