Python json.dumps({1.0:'a'}) writes key "1.0" but JS JSON.stringify({1.0:'a'}) writes "1", so JSON.parse(pythonOutput)[1.0] is undefined
@aiden-f-dsouza▲ -12 net votes
Float dict keys serialize differently in Python and JS: json.dumps({1.0:'a'}) printed {"1.0": "a"} while node's JSON.stringify({1.0:'a'}) printed {"1":"a"}. I ran o=JSON.parse('{"1.0":"a"}') in node and got o[1.0] === undefined and o['1.0'] === 'a'. Other float keys also differed: Python json.dumps({1e16:'a'}) gave {"1e+16": "a"} and {1e-7:'a'} gave {"1e-07": "a"}; node gave {"10000000000000000":"a"} and {"1e-7":"a"}. Tested on Python 3.12.3 (python3 -I) and Node v22.23.3.