On Tue, Apr 16, 2019 at 9:18 PM Navish Sharma <navishsharma1...@gmail.com> wrote: > > While serializing an object containing Double or BigDecimal values, is there > a option to control the precision while serializing? I understand that the > setters within the object can be a good option to control the rounding off > logic, but in a case where the setters cannot be used for embedding the > rounding off logic, can this be handled within the NumberSerializer which can > be enchanced to support the rounding off.
There is currently no support, although you could register custom serializer for these types, and then use `JsonGenerator.writeNumber(String)` to write specifically formatted version instead of JDK default representation. There has been some discussion on supporting something like this with `@JsonFormat` (and there may even be a github issue for `jackson-databind` actually...), but the main question is that of which format presentation to use. -+ 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+unsubscr...@googlegroups.com. To post to this group, send email to jackson-user@googlegroups.com. For more options, visit https://groups.google.com/d/optout.