jackson-dataformats-text icon indicating copy to clipboard operation
jackson-dataformats-text copied to clipboard

Add serialization of object members for csv.

Open ptahchiev opened this issue 7 years ago • 8 comments

  • Keep track of object nesting, similar to jackson-dataformat-properties

ptahchiev avatar Jul 29 '18 20:07 ptahchiev

Is there any problem with this PR?

nstdio avatar Nov 09 '19 14:11 nstdio

@nstdio At this point there is one practical problem (aside from merge conflict): being new feature, this needs to be rebased against 2.11. But I do not remember any specific problem against the concept: my main question would be that since @JsonUnwrapped allows similar usage, whether overlap is problematic. Maybe it isn't, but functionality-wise this covers similar case -- however, I can see how with multi-format output, not using that annotation would be preferable.

I will add this PR to my todo list to have another look as it seems valuable, in helping deal with nested values in CSV.

cowtowncoder avatar Nov 09 '19 22:11 cowtowncoder

@cowtowncoder yes, exactly. Also, users not always control/own models and adding a @JsonUnwrappd annotation might be not an option.

nstdio avatar Nov 10 '19 08:11 nstdio

Ok. So, finally getting to this one.... and realizing there are actually couple of problems to resolve.

A practical one is that unfortunately patch has re-styled code, making diff unnecessarily large, and adding work when I have to undo many (not all, just many) changes. Since I will need to rebase it to be from 2.11, manually, these are bit unfortunate.

But a bigger one is this: I don't want additional processing overhead for common case of no nesting. So will need to figure out how to avoid automatic prepending and only change name in cases where it is needed for nesting.

So this may take a bit longer yet.

cowtowncoder avatar Nov 26 '19 03:11 cowtowncoder

Another thing I am not sure about is addition of path separator per column; not sure how that would work compared to per document (one for whole CsvSchema) would work. Reformatting is especially disruptive for CsvSchema in general.

cowtowncoder avatar Nov 26 '19 05:11 cowtowncoder

I'd love to see this feature goes in the code. since CVS is much more compact than JSON in dealing with large data set. In my case I have to convert between json and CSV without any predefined POJO involved. This is much needed and I don't want to create a fork out of the official Jackson

branaway avatar Feb 10 '21 00:02 branaway

Note: would like to consider this, but would need rework to merge against 2.13 (next applicable minor version).

cowtowncoder avatar Feb 10 '21 03:02 cowtowncoder

Ok so due to unfortunate reformatting of this patch (probably accidentally done by some reformatter?), it's bit difficult to follow, but now realized that this would only support serialization, not deserialization. Not quite sure if that makes sense on its own; users might be surprised to find they can serialize things but not deserialize.

cowtowncoder avatar Feb 10 '21 03:02 cowtowncoder