this post was submitted on 11 Mar 2025
21 points (100.0% liked)

Programmer Humor

21779 readers
1513 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 

you are viewing a single comment's thread
view the rest of the comments
[–] bisby@lemmy.world 10 points 1 week ago

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.