Skip to content
This repository has been archived by the owner on Jan 22, 2019. It is now read-only.

Add SerializationFeature to Serialize Objects with toString() method #158

Open
joseaio opened this issue May 9, 2018 · 1 comment
Open

Comments

@joseaio
Copy link

joseaio commented May 9, 2018

I can't find anything as this...

This Feature enables a default serialization (for Objects) calling their toString() method instead of launch error:

com.fasterxml.jackson.databind.JsonMappingException: CSV generator does not support Object values for properties (through reference chain: java.util.ArrayList[0]->***)
at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:275)
at com.fasterxml.jackson.dataformat.csv.CsvGenerator._reportMappingError(CsvGenerator.java:912)
at com.fasterxml.jackson.dataformat.csv.CsvGenerator.writeStartObject(CsvGenerator.java:522)
at com.fasterxml.jackson.core.base.GeneratorBase.writeStartObject(GeneratorBase.java:274)
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:151)

@cowtowncoder
Copy link
Member

Thank you for suggesting this feature. It will be interesting to think how this could be implemented, given that this would either need to be configuration in jackson-databind to apply for some types, or, if here, how to implement it (since databind has no way to know specific rules are needed and will send tokens that CsvGenerator has to somehow reroute).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants