1

I have a Java POJO class

eg:

public class Student {
String name;
String rollNo;
}

I have rest API's that return the above bean class. Some are returning this in the snake case for example roll_no. How can I make the model mapper configured to accept both snake case and camel case serialisation.

  • 2
    Does this answer your question? [JSON Jackson parse different keys into same field](https://stackoverflow.com/questions/19564711/json-jackson-parse-different-keys-into-same-field) – Prog_G Oct 06 '21 at 06:47
  • Thanks for this. I am able to parse the same in both ways using @JsonAlias – Akhil Korissery Oct 06 '21 at 07:31

1 Answers1

2

This anotation might help you:

@JsonAlias({"roll_no", "rollNo", "rollno"})
String rollNo;

if you want more detail, follow this link @JsonAlias anotation