I have a DTO with a nested object:
public class MyDto {
private Place place;
private Integer int1;
private Integer int2;
// ... other fields, lombok getter
}
While this is working fine if marshalled to JSON it can not be marshalled to CSV with error:
CSV generator does not support Object values for properties (nested Objects) (through reference chain: java.util.ArrayList[0]->package.MyDto["place"])
In csv i need at least some fields of place.
How to handle this without creating a new Object? Is there a Jackson way for this use case?
Is there a way to add fields (by providing getter) that are only fetched by csv and on the other hand let CSV ignore place field?
What do you suggest?
question from:
https://stackoverflow.com/questions/65888945/jackson-how-get-csv-and-json-from-same-object-with-nested-field 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…