I have some multiplatform code that generates JSON...
# serialization
c
I have some multiplatform code that generates JSON. However, sometimes, the JSON is slightly different in ways that doesn't matter (e.g. one system writes
1
and another writes
1.0
). Could KotlinX.Serialization be used to deserialize multiple JSON representations and tell me if they are equal or not?
e
whenever they're equivalent depends on how they're used
if you parse those into JsonElements, they'll be unequal
c
Is there a way to parse these such that they are equal?
s
Sure, you could parse them as doubles, for example. Or even use a custom deserializer with logic to normalize such entries.