pratanpornp / google-gson

Automatically exported from code.google.com/p/google-gson
0 stars 0 forks source link

ability to use stripTrailingZeros in BigDecimal representation #615

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Our JSON messages currently contain a lot of zeros, that are redundant for our 
purposes, because BigDecimal objects include those zeros in their 
serialization.  I understand why those zeros should be preserved by default, 
but it would be great if there was a way to remove them.  It seems like a 
configuration option, that controls the invocation of the BigDecimal 
stripTrailingZeros() method, would be perfect.

We could use a type adapter.  However, it appears impossible to serialize raw 
text.  The BigDecimal objects would have to be serialized with double quotes, 
but we're trying to trim things down as much as possible.

Original issue reported on code.google.com by samuel.j...@gmail.com on 15 Dec 2014 at 11:24