java - Property names with dots Jackson JSON Parsing -


i'm trying use @jsonproperty name property dots.

import com.fasterxml.jackson.annotation.jsonignoreproperties; import com.fasterxml.jackson.annotation.jsonproperty;  @jsonignoreproperties(ignoreunknown = true) public class compare {  @jsonproperty("test.total") public hitstotal total;  public hitstotal gethitstotal() {     return total; }  public void sethitstotal(hitstotal hitstotal) {     this.total = hitstotal; } } 

when serialization/deserialization happens, don't see property test.total. shows hitstotal instead. right way of doing this?

can't believe made mistake! it'll useful can accidentally run this, nevertheless! problem not using jackson mapper serialization.

was doing serialization using

jsonobject(new compare()) 

need use jackson mapper instead

objectmapper om = new objectmapper(); jsonobject(om.writevalueasstring(new compare())) 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -