In one of the cases in my project , I encountered a case where I need to fetch JSONPropoerty name to build another json object.
I have a pojo class:
public class Records {
@JsonProperty("NEWVALUE")
private String new;
}
now in another class I need to create JSON Object using the json property names associated with my Record pojo class's @JsonProperty names.
I want something like
Record rec=new Record();
JsonNode tmpNode=new JsonNode();
String key= <somehow get value from rec object i.e. "NEWVALUE">
((ObjectNode) tmpNode).put(key, "abc"));
Is there any way to get the json property names associated with java field names.