I have a class definition say
class Employee {
String id;
String name;
int age;
//getters and setters
}
I want to create a json object out of it as follows
{
"id" : "A12",
"employee_name" : "Abhishek"
age : 97
}
Notice that employee_name
does not correspond to POJO variable name
. So can I add certain annotation which will help me do so ? Something Like
@JSONKey(value="employee_name")
String name
Give solutions related to GSON and/or Jackson.