I have a source A, a wrapper API B and a destination C.
I have to call wrapper API B from destination C. I have no access to source A.
source A produces following json output:
{
"id" : 1,
"created_on" : "27July"
}
In wrapper API B, I am consuming the above JSON output using following POJO:
class B
{
Long id;
String created_on;
}
Wrapper API is able to get the value of created_on from source A. When I call A from B, I get this ouptut:
{
"id" : 1,
"created_on" : "27July"
}
But in destination C, i have the following POJO:
class C
{
Long id
String createdOn
}
When I call Wrapper API B from C, i am not able to get the field ‘createdOn’.
When I call B from C, i get only this:
{
"id" : 1
}
The mapping between created_on and createdOn is not happening.
Basically, i want to return ‘createdOn’ from Wrapper API B instead of ‘created_on’.
Currently, wrapper B is sending ‘created_on’ , but i want it to return ‘createdOn’.
How do I do it? I have tried @JSONProperty but it is not working
>Solution :
public class C {
Long id
@JsonProperty("created_on")
String createdOn
}
It’s should works.