Hacker News new | ask | show | jobs
by samhw 1703 days ago
> Though I'm sure someone's going to step in and say "Have you not heard of [stupendously niche use case]?"

> they might hand-edit a machine-generated one to make a change someplace in it

Ah, there's [stupendously niche use case] ;)

Seriously, though, I do agree with your point that good software should handle every edge case. I'm not arguing that.

But the case for having trailing commas does seem to be generally predicated on handwritten JSON, so I'm saying it's _unlikely_ it would be used in that way, and therefore that such failures would be rare and thus not a very grave counterargument.

1 comments

You also have to think about security implications of a hostile client being able to crash a remote parser with gigabytes of context, though if it crashes on malformed json then they could do that with a much shorter fragment. In the well intentioned case, being paged in the middle of the night to debug a weird crash isn't fun, so it's better to have an accurate diagnosis (version mismatch) in the log if not prevent the crash outright. There is also the matter of every weird javascript implementation that would have to be updated, if JS can't already accept the trailing commas. It just doesn't seem worth hassling over.