CSV mapper not honoring @JsonDeserialize tag

22 views
Skip to first unread message

Thomas Eyre

unread,
Jul 6, 2020, 5:07:38 PM7/6/20
to jackson-user
Using Freebuilder (https://github.com/inferred/FreeBuilder) I build an interface of an object that I can serialize into Json. Using the JsonDeserialize tag, I can point to the inner Builder class to get the JsonProperty names, etc by tagging '@JsonDeserialize(builder =MyInterface.Builder.class)'. 

This works fine when using Jackson to serialize into Json, but when using CSVSchema and CSVMapper, it claims that no @JsonProperty tags are present. 

However, if I use a normal ObjectMapper and ObjectWriter to turn the object into a Json String, turn that Json String into a JsonNode, and use a CSVMapper on that, it works fine. 

Is there a reason the CSV portion doesn't honor the @JsonDeserialize tag like regular ObjectMapper does?

Thanks in advance for any help.  

Tatu Saloranta

unread,
Jul 7, 2020, 4:41:01 PM7/7/20
to jackson-user
CSVMapper has nothing special that should block use of that tag so I
don't see how this could happen.
At this point I think it would be best to file a Github issue against
jackson-dataformats-text repo, with full reproduction,
without external dependencies (I am not familiar with FreeBuilder, but
if it can just create sources, maybe include those directly).

-+ Tatu +-

>
> --
> You received this message because you are subscribed to the Google Groups "jackson-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jackson-user...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/jackson-user/71102b04-6167-4df1-9685-c5352ca3ca0fo%40googlegroups.com.

Thomas Eyre

unread,
Jul 10, 2020, 3:56:00 PM7/10/20
to jackson-user
I created an issue as requested and included a repo I created with an example. 


Thanks again!

-Tom

On Tuesday, July 7, 2020 at 4:41:01 PM UTC-4, Tatu Saloranta wrote:
On Mon, Jul 6, 2020 at 2:07 PM Thomas Eyre <t.e....@gmail.com> wrote:
>
> Using Freebuilder (https://github.com/inferred/FreeBuilder) I build an interface of an object that I can serialize into Json. Using the JsonDeserialize tag, I can point to the inner Builder class to get the JsonProperty names, etc by tagging '@JsonDeserialize(builder =MyInterface.Builder.class)'.
>
> This works fine when using Jackson to serialize into Json, but when using CSVSchema and CSVMapper, it claims that no @JsonProperty tags are present.
>
> However, if I use a normal ObjectMapper and ObjectWriter to turn the object into a Json String, turn that Json String into a JsonNode, and use a CSVMapper on that, it works fine.
>
> Is there a reason the CSV portion doesn't honor the @JsonDeserialize tag like regular ObjectMapper does?
>
> Thanks in advance for any help.

CSVMapper has nothing special that should block use of that tag so I
don't see how this could happen.
At this point I think it would be best to file a Github issue against
jackson-dataformats-text repo, with full reproduction,
without external dependencies (I am not familiar with FreeBuilder, but
if it can just create sources, maybe include those directly).

-+ Tatu +-

>
> --
> You received this message because you are subscribed to the Google Groups "jackson-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jackso...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages