Ben Finney writes: > Victor Hooi writes: [- -] >> For example: >> >> { >> "hostname": "example.com", >> "version": "3.0.5", >> "pid": { >> "floatApprox": 18403 >> } >> "network": { >> "bytesIn": 123123, >> "bytesOut": { >> "floatApprox": 213123123 >> } >> }
[- -] > In JSON there is no distinction at all, the only numeric type is > ‘float’. What information is there in the input that can be used to > know which values should result in an ‘int’ instance, versus values > that should result in a ‘float’ instance? I seem to get ints in the example data. >>> json.load(io.StringIO('{"floatApprox":31213}')) {'floatApprox': 31213} -- https://mail.python.org/mailman/listinfo/python-list