klaxon
klaxon copied to clipboard
Klaxon fails to convert Int/Long to BigInteger
Running
data class MyNumber(val number: BigInteger)
data class MyList(val list: List<MyNumber>)
Klaxon().parse<MyList>("""{"list": [{"number": 123456789000}, {"number": 123456789000000000000}]}""")
gives me the following error:
Unable to instantiate MyNumber:
Parameter number: expected java.math.BigInteger but received java.lang.Long (value: 123456789000)
If I replace BigInteger
in the definition above with Long
and otherwise keep the code the same I get:
Unable to instantiate MyNumber:
Parameter number: expected kotlin.Long but received java.math.BigInteger (value: 123456789000000000000)
Using Klaxon 5.2.