When writing a reader, one has to step through the JSON stream entry by entry. Value accessors like nextInt() fail if they encounter NULL; dealing with JSON elements that can, in Kotlin terms, be Int? is cumbersome.
One could argue for this.peek() == JsonToken.NUMBER (where does the distinction between integers and floats happen, by the way?); that's a design decision between silent and loud parsing errors.
When writing a reader, one has to step through the JSON stream entry by entry. Value accessors like
nextInt()
fail if they encounterNULL
; dealing with JSON elements that can, in Kotlin terms, beInt?
is cumbersome.The workaround is quite easy:
One could argue for
this.peek() == JsonToken.NUMBER
(where does the distinction between integers and floats happen, by the way?); that's a design decision between silent and loud parsing errors.Please include nullable variants into
JsonReader
.