Currently I am doing something like that:
public class MyObject{
public String name;
//constructor here
}
So, if I serialize it:
ObjectMapper mapper = new ObjectMapper();
MyObject o = new MyObject("peter");
mapper.writeValue(System.out,o);
I get
{"name":"peter"}
I'd like to make this generic, so class would be:
public class MyObject{
public String name;
public String value;
//constructor here
}
So that this call:
ObjectMapper mapper = new ObjectMapper();
MyObject o = new MyObject("apple","peter");
mapper.writeValue(System.out,o);
would lead to
{"apple":"peter"}
is it possible?