Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {"amount" : null}
- class BigDecimalDeserializer : JsonDeserializer<BigDecimal> {
- override fun deserialize(json: JsonElement?, typeOfT: Type?, context: JsonDeserializationContext?): BigDecimal {
- if (json!!.isJsonNull) {
- return BigDecimal.ZERO
- }
- json?.let {
- try {
- json.asBigDecimal
- } catch (t: NumberFormatException) {
- return BigDecimal.ZERO
- }
- }
- return json?.asBigDecimal!!
- }
Add Comment
Please, Sign In to add comment