Json object declarations, commas and browser support

We encountered a problem with Internet Explorer. Care needs to be taken when declaring objects using json. Internet Explorer baulks at extra commas, the following will fail due to the extra comma after the result.count declaration.

We tracked this down using grep, something like this will find occurences:

$ grep -Plir ',[\s]*\}' * --include=*.js

One side issue with that was when the sequence occurs on the same line as the NUL character identifying the end of file.

This one matches:

While this one does not:

References

Json memo
The application/json Media Type for JavaScript Object Notation (JSON). provides information for the Internet community. It does
not specify an Internet standard of any kind. Distribution of this
memo is unlimited.