https://kotlinlang.org logo
#klaxon
Title
# klaxon
d

damian

09/12/2018, 9:23 AM
Is there a way to handle NaN for float values when parsing the json using klaxon? Currently getting
Pending exception java.lang.RuntimeException: Unexpected character at position 1023: 'n' (ASCII: 110)'
s

Shawn

09/12/2018, 10:41 AM
the JSON spec omits
NaN
,
+/-Inf
unfortunately
if your data source is emitting those tokens, then it’s out of spec and you may or may not want to replace it if you can
if not, you may need to perform a bit of search and replace with a suitable replacement value
k

karelpeeters

09/12/2018, 12:32 PM
Or write you own converter for float values.
d

damian

09/12/2018, 3:58 PM
OK thank you both
12 Views