vane@lemmy.world to Programmer Humor@programming.dev · 1 day agoWell it's JSON so what can go wrong.message-squaremessage-square16fedilinkarrow-up116file-text
arrow-up116message-squareWell it's JSON so what can go wrong.vane@lemmy.world to Programmer Humor@programming.dev · 1 day agomessage-square16fedilinkfile-text
minus-squarebisby@lemmy.worldlinkfedilinkEnglisharrow-up9·24 hours agoCounter point… Both are generating perfectly valid JSON, so who cares? Python 3.13.2 (main, Feb 5 2025, 08:05:21) [GCC 14.2.1 20250128] Type 'copyright', 'credits' or 'license' for more information IPython 9.0.2 -- An enhanced Interactive Python. Type '?' for help. Tip: IPython 9.0+ have hooks to integrate AI/LLM completions. In [1]: import json In [2]: json.loads('{"x": 1e-05}') Out[2]: {'x': 1e-05} In [3]: json.loads('{"x":0.00001}') Out[3]: {'x': 1e-05} Welcome to Node.js v20.3.1. Type ".help" for more information. > JSON.parse('{"x":0.00001}') { x: 0.00001 } > JSON.parse('{"x": 1e-05}') { x: 0.00001 } Javascript and Python both happily accept either format from the string and convert it into a float they are happy with.
Counter point… Both are generating perfectly valid JSON, so who cares?
Python 3.13.2 (main, Feb 5 2025, 08:05:21) [GCC 14.2.1 20250128] Type 'copyright', 'credits' or 'license' for more information IPython 9.0.2 -- An enhanced Interactive Python. Type '?' for help. Tip: IPython 9.0+ have hooks to integrate AI/LLM completions. In [1]: import json In [2]: json.loads('{"x": 1e-05}') Out[2]: {'x': 1e-05} In [3]: json.loads('{"x":0.00001}') Out[3]: {'x': 1e-05}
Welcome to Node.js v20.3.1. Type ".help" for more information. > JSON.parse('{"x":0.00001}') { x: 0.00001 } > JSON.parse('{"x": 1e-05}') { x: 0.00001 }
Javascript and Python both happily accept either format from the string and convert it into a float they are happy with.