Bean:
@XmlRootElement(name = "integer") @XmlAccessorType(XmlAccessType.FIELD) public class IntegerWrapper implements Serializable { private static final long serialVersionUID = -455136597629446657L; @XmlValue private Integer value; // getters/setter (no annotations) } Code:
ObjectMapper mapper = new ObjectMapper(); IntegerWrapper iw = new IntegerWrapper(); iw.setValue(new Integer(11)); System.out.println("IntegerWrapper\n" + mapper.writeValueAsString(iw)); Result:
{"value":11,"fieldHandler":null} Why is "fieldHandler" in the resulting object, and how do I get rid of it?
UPDATE:
Appears only when I run it through maven or as a web service where Jackson is the JSON provider. IntegerWrapper is in the package where are some JPA beans but IntegerWrapper is not mentioned in persistence.xml. When I copy it to another package fieldHandler disappears.