-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Allow serialization of BigDecimal
as String, using @JsonFormat(shape=Shape.String)
, config overrides
#1911
Comments
This is bit too granular thing, at this point, as I would hope to avoid adding new non-general It may be used on specific properties, but also via "configOverrides" for type; something like
If this does not yet work (it requires support from serializer), it should be added. |
That seems reasonable enough. I'll test on monday and come back. |
@cen1 Thanks. And thank you for reporting this; I agree that this is important use case for javascript clients. |
Ok while conversion does work for primitive types, it is not yet supported for |
BigDecimal
as String, using @JsonFormat(shape=Shape.String)
, config overrides
@cowtowncoder I cannot see anywhere what method is called on the BigDecimal to convert it to a string? Is it |
@hashhar what are you trying to achieve, specifically? Method will be either in |
I want to control how the BigDecimal gets converted into a string when using the I found the code and it looks like we even have a config for it as For other people who come across this, see the code at https://github.com/FasterXML/jackson-databind/blob/master/src/main/java/com/fasterxml/jackson/databind/ser/std/NumberSerializer.java#L127 |
Ok. Yes, at some point it may make sense to write a custom serializer: with |
When REST API is consumed by JavaScript, in order to prevent the loss of precision, BigDecimal is normally passed as a string. While adding a custom serializer is easy, I think this is a very common case and warrants an out of the box SerializationFeature.
The text was updated successfully, but these errors were encountered: