Nikolay Kasyanov
06/14/2021, 2:11 PMKSerializer.deserialize
), is there a way to get access to the “raw” value of a primitive? As a string, for example. Since JSON numbers don’t have to be floating point numbers (by the standard https://www.json.org/json-en.html, although some implementation do assume that they are all double, unfortunately), I need a way to read fractional numbers from JSON without compromising their precision (to convert them to some decimal type, for example), none of the existing Decoder
can do that it seems. Am I missing something?
One option would be to write such values as strings server-side, but 1) it’s not always feasible to change existing endpoints that are just fine 2) one doesn’t always control the API.
UPD found an issue, apparently it’s not possible atm: https://github.com/Kotlin/kotlinx.serialization/issues/1405Nikolay Kasyanov
06/14/2021, 2:12 PMNikolay Kasyanov
06/14/2021, 2:24 PM