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
Post a Comment