Given the following POJOs ..
public class City {
private String title;
private List people;
}
...
public
Based on this link I suspect the field-level annotation only delegates writing the value not entire properties.
A (rather kludgey) workaround might be to have a custom serializer for the entire City class:
@JsonSerialize(using = CitySerializer.class)
public class City {
private String title;
@JsonIgnore
private List people;
}
...and then
public class CitySerializer extends JsonSerializer {
private static final int START_INDEX = 1;
@Override
public void serialize(City city,
JsonGenerator generator,
SerializerProvider provider) throws IOException {
generator.writeStartObject();
// Write all properties (except ignored)
JavaType javaType = provider.constructType(City.class);
BeanDescription beanDesc = provider.getConfig().introspect(javaType);
JsonSerializer