-
-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for more flexible header row(s) #32
Comments
@lyonssp I am sure there are all kinds of esoteric "sub-formats" in use, as well as macro substitutions cases. For improvements, however, suggestions need to be bit more concrete. There are some existing pieces of functionality that may be of use. One example is As to macro replacement I think this should be outside of core decoder, in form of pluggable handlers (with perhaps one or two standard implementations). One such idea is: which in some form or other would allow handlers to "refine" (or perhaps transform) incoming String values. One use case would be macro expansion for simple value substitution. So, I guess I am open to improvement ideas. They just need to be somewhat specific wrt what to improve; but also generic in the sense that ideally concept is applicable to more than one backend format, in some form. |
Sure, I'll go more specific than my original headline. In my particular use-case, I'm just trying to provide a CSV template that is meant to be filled in and returned in the same format. Clients have found it helpful to have placeholder values underneath the header to indicate what the significance of the column is. Let me provide an example: class CsvRow {
@JsonProperty("first")
private String firstName;
@JsonProperty("last")
private String lastName;
@JsonProperty("dob")
private LocalDate dateOfBirth;
} If I want to write records of this type into a CSV, then I would next go ahead and create a
Now, in my use-case, I want to have the ability to create a CSV like
using the same source of truth for a header that I'm using to interpret the file when it comes back, or in other words the same I guess this amounts to being able to force-write rows into the CSV that don't adhere to the |
Not quite sure of the ask here (whether this is for reading or just writing; how would feature be exposed etc) so will close. May be re-filed with bit more detail. |
In enterprise contexts, CSV formats can take on really strange formats, and in my experience those formats commonly include sub-headers, headers that do not correspond to lower row values, and placeholders for CSVs that serve as templates to be filled in.
Jackson doesn't seem to currently support anything except the idea of a single header corresponding to the data that will be in a CSV.
There are libraries that do accomplish this -- I've used beanio -- but are just archaic in almost every other way. We use Jackson so much for other dataformats and use-cases, I'd love to keep to Jackson for CSVs as well.
The text was updated successfully, but these errors were encountered: