Is there a way to deserialize and serialize a field in a different way by using jsonschemapojo2?

226 views Asked by At

Let's assume I have the following pojo

class pojo{
  String color;
}

I want to deserialize color like so:

{
 COLOR: "red"
}

and serialize color like so:

{
 color: "red"
}
1

There are 1 answers

0
Vladimir Stanciu On

If you want to change the name of the property when serializing, you can use the @JsonProperty annotation like this : @JsonProperty("color1")

LE: Now i've understood what you want. You can use @JsonFormat(with = JsonFormat.Feature.ACCEPT_CASE_INSENSITIVE_PROPERTIES) to accept uppercase attributes.