Nontrailing separators do not spark joy (opens in new tab)
This is valid JSON: { "a": 1, "b": 2, "c": 3 } This is invalid JSON: { "a": 1, "b": 2, "c": 3, } The difference is the last comma. The JSON grammar specifies that a comma can separate two members of an object but not postcede ("trail") a member. I think this was a design mistake. Say we want to add two new keys to the struct, one before the "a" member and one after the "c" member. Here's what it would look like if trailing commas were permitted: { + "x": 0, "a": 1, "b": 2, "c": 3, + "y": 4, }...
Read the original article