avoid reparsing numbers when serializing
Alternative to #1073
This change avoids creating NumericNodes and parsing strings to numbers which ultimately have to be turned back to strings to write them.
I've had to leave the BigIntegerNode usage in there. Removing it breaks some tests. I've debugged and it is down to how writeNumber(String) is implemented in jackson-databind TokenBuffer. We would need to change this class in jackson-databind to fix this (and that is not likely to happen as it will probably cause other issues). Basically, writeNumber(String) is assumed to be a non-integer in TokenBuffer.
Unit test required
Unit test required
@cchantep I think the existing tests do a good job of testing this code change.
@mkurz I can make a small adjustment in this PR because newer jackson releases have a new method that I added so this PR can use it
@mkurz I can make a small adjustment in this PR because newer jackson releases have a new method that I added so this PR can use it
haha, I just commented in the code ;) yes please go ahead
(I guess it will be
case tb: TokenBuffer =>
tb.writeNumber(raw, true)
because I was looking at your fork already ;) )
@mkurz I can make a small adjustment in this PR because newer jackson releases have a new method that I added so this PR can use it
haha, I just commented in the code ;) yes please go ahead
(I guess it will be
case tb: TokenBuffer => tb.writeNumber(raw, true)because I was looking at your fork already ;) )
I pushed that change.
@pjfanning Looking at your fork, do you also want to add PRs for the rest?
- optional support for Jackson's fast decimal parser
- StreamWriteConstraints
?