With these classes
import com.fasterxml.jackson.annotation.JsonProperty;
public class Foo {
@JsonProperty
public String bar;
}
public class Bar {
@JsonProperty
public Foo foo;
@JsonProperty {
public String baz;
}
I can serialize and deserialize a Bar instance to/from JSON objects like this one:
{
"foo": { "bar": "bar" },
"baz": "baz"
}
Is there a Jackson annotation that will let me "inline" the foo field, so that my JSON representation becomes this?
{
"bar": "bar",
"baz": "baz"
}
I'm totally OK with it throwing errors in case of naming conflicts etc, but it would be nice if I didn't have to implement a custom serializer for this.