I'm using the Jackson library.
I want to ignore a specific field when serializing/deserializing, so for example:
public static class Foo {
public String foo = "a";
public String bar = "b";
@JsonIgnore
public String foobar = "c";
}
Should give me:
{
foo: "a",
bar: "b",
}
But I'm getting:
{
foo: "a",
bar: "b",
foobar: "c"
}
I'm serializing the object with this code:
ObjectMapper mapper = new ObjectMapper();
String out = mapper.writeValueAsString(new Foo());
The real type of the field on my class is an instance of the Log4J Logger class. What am I doing wrong?