this post was submitted on 25 Apr 2022
29 points (100.0% liked)

Programmer Humor

33385 readers
683 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
top 4 comments
sorted by: hot top controversial new old
[–] [email protected] 5 points 2 years ago (1 children)

Yeah, I fall for that so often. Can't move or delete lines without double-checking that you didn't accidentally leave a comma at the end...

[–] [email protected] 4 points 2 years ago (1 children)

And javascript is otherwise so lax! You like semicolons? Put as many of them as you want wherever you like! Or don't.

[–] [email protected] 5 points 2 years ago

JSON is a serialization format based on js syntax. It's not the same as JavaScript, it's usually stricter. Those stricter rules are designed to make it easier to parse. In actual js, trailing commas are just fine (although i think some versions of internet explorer parsed them as nulls for some reason.)

[–] [email protected] 3 points 2 years ago

The best approach I've seen is to just treat commas as whitespace the way EDN does.