I have a class like this:
@JsonPropertyOrder({"Chilli"})
public interface ChilliReport {
@JsonProperty("Chilli")
String getChilli();
@JsonProperty("Price")
String getPrice();
}
// Then, I'll populate this with some values.
CsvMapper csvMapper = new CsvMapper();
CsvSchema schema = csvMapper.schemaFor(ChilliReport.class).withHeader();
String payload = csvMapper.writer(schema).writeValueAsString(reports);
System.out.println(payload);
Why is is that sometimes, the field "chilli" will be quoted while sometimes, it won't be?
Ex: Sometimes, my data looks like this:
"Chilli" "Price"
"Red",10
Other times like this: "Chilli" "Price"
Yellow,10
Btw, I changed the name of the class and actual names of the fields but that's the gist of my problem