3 ms·
"> Objects may have a single trailing comma." Any arguments against this one? My knee jerk reaction is 'yay'
by chris-orgmenta 3y ago
"> Objects may have a single trailing comma."
Any arguments against this one? My knee jerk reaction is 'yay'
- givemeethekeys 3y agoWhy would you put a trailing comma when there's nothing after it? A comma isn't a period :-/
- Taywee 3y agoWhen manually modifying JSON, it really helps avoid accidentally missing a comma when you add or reorder elements. JSON isn't English. The comma doesn't mean what it does in English, so I don't see why a period would be appropriate either.
- dangerlibrary 3y agoBecause it follows the general principle of making it easier to change [0]. Fewer edits, cleaner diffs. Useless from the perspective of a wire format, but nice for things like config files, which seem to be the use cases json5 is targeting. [0] Bullet pt 3: https://betterprogramming.pub/5-essential-takeaways-from-the-pragmatic-programmer-6bb3db986294 https://betterprogramming.pub/5-essential-takeaways-from-the...
- Tmpod 3y agoMakes copy-pasting and reordering lines easier, which is quite handy.
- everybodyknows 3y agoSimplifies JSON-generation code, typically saving a conditional.
- lordgrenville 3y agoJust noticed today that the Python formatter "black" does this, I really disagree. Of course I realise that by noticing its changes and arguing about them I am missing the whole point of using it.
- tejtm 3y agorecursing issue since forever, "separator" v.s. "terminator" both can work. For data rows, I prefer termination as makes missing columns explicit. But being optional here, it means nothing. I guess it facilitates low effort scripting that doesn't have to treat the last element differently.