Not A Duplicate: How to serialize nested collection of objects with Jackson
My question was immediately closed after somebody left a comment within 49 seconds, so please don't continuously bot-close questions that are not duplicates. The above is for serialization, not deserialization, which to my knowledge Jackson handles differently.
Content:
I have POJO(s) with the following definition(s):
public class SomePojo {
public String name;
public int type;
public OtherPojo ref;
}
public class OtherPojo {
public int x, y, z;
}
And a CSV containing data in the form:
name,type, x, y, z
foo,1,0.3,1.1,-0.5
bar,5,7.3,-0.1,1.5
Typically with Jackson I've only mapped a 1:1 (meaning each field went to a single column), but is it possible to tell the CsvSchema
or the CsvMapper
to treat a range of fields as a nested POJO for the type being read?
Yes, you should be able to do this by defining a custom csvSchema for your CSV mapping