Json decoding is not JSON-compliant because of int/double parsing #46883
Labels
area-core-library
SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.
closed-not-planned
Closed as we don't intend to take action on the reported issue
library-convert
The following three JSON files are semantically identical according to the JSON standards:
{ "list": [ "a", "b", "c" ], "index": 1 }
{ "list": [ "a", "b", "c" ], "index": 1.0 }
{ "list": [ "a", "b", "c" ], "index": 1e0 }
However, in the Dart VM they are treated differently. For example, consider the following code:
I'm not really sure what the right answer is here. It's probably "wontfix", and the documentation requested in #46682 should just say that developers should not rely on the returned values being
int
ordouble
and should instead always saytoInt()
ortoDouble()
as desired. I could also see an argument that we should always usedouble
, since that would be less bug-prone.The text was updated successfully, but these errors were encountered: