I am trying to Map a JSON response to a Java POJO which has a different field name from different API. I need an efficient way to do this reducing boilerplate codes.
I have tried mapping the JSON property field in Java POJO. However, the problem is I am fetching data from different sources.
Let's say I have below user class
Class User{
String name;
String contact;
}
The JSON I may receive from different sources can be
{"name": "ABC" , "contact": "123456"}
or
{"userName": "XYZ" , "mobileNo":"4354665"}
There may be more variations as we go on integrating more API's
Is there a way I can archive this? above is just a simple example
there could be more complex JSON object I may need to read. like List of User etc.