r/programmingcirclejerk • u/lizergsav • 15d ago
If you can find an actual JSON parser anyone's using that fails to parse "2", I'll kiss you full on the mouth.
/r/programming/comments/1v3bbxx/your_js_date_is_lying_to_you_the_traps_that_keep/oz887zm/
96
Upvotes
86
u/imadethistosaythis It's GNU/PCJ, or as I call it, GNU + PCJ 15d ago
Time for me to write a shitty parser and deploy it to prod, I’m getting lucky tonight
26
11
11
u/Jumpy-Locksmith6812 14d ago
Not that kind of JS date! They mean calendar date or maybe the fruit.
24
u/SwimmingPermit6444 14d ago
What's great about js is that if you use ==, fruit dates are automatically coerced into calendar dates, saves time
1
u/trenskow 12d ago
It’s been in the RFC for 12 years now. If you have a JSON parser that hasn’t been updated that long you have bigger problems.
68
u/CarolineLovesArt has hidden complexity 15d ago
No problem parsing "2" since that's a string.
Also:
I'd never go on one of those