Skip to content

Commit

Permalink
try to avoid reparsing numbers as BigDecimal when serializing
Browse files Browse the repository at this point in the history
  • Loading branch information
pjfanning committed Sep 5, 2024
1 parent 6d2feae commit ffa0071
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@ private[jackson] class JsValueSerializer(jsonConfig: JsonConfig) extends JsonSer

if (raw.indexOf('E') < 0 && raw.indexOf('.') < 0)
json.writeTree(new BigIntegerNode(new BigInteger(raw)))
else
else if (shouldWritePlain)
json.writeTree(new DecimalNode(new JBigDec(raw)))
else
json.writeTree(new DecimalNode(stripped))
}

case JsString(v) => json.writeString(v)
Expand Down

0 comments on commit ffa0071

Please sign in to comment.