You can use mixin to make sure the class is serialized according to your needs. Consider the following:
public class ColorRGBA {
public float a;
public float b;
public float g;
public float r;
}
Then create a mixin where you ignore the property a.
@JsonIgnoreProperties("a")
public abstract class RGBMixin {
}
Finally, configure your mapper using mixin:
ObjectMapper mapper = new ObjectMapper();
mapper.addMixInAnnotations(ColorRGBA.class, RGBMixin.class);
System.out.println(mapper.writeValueAsString(new ColorRGBA()));
The output will be:
{ "": 0,0, "": 0.0, "": 0,0}
, ObjectMapper.addMixInAnnotations Jackson 2.5 :
mapper.addMixIn(ColorRGBA.class, RGBMixin.class);
JavaDocs