This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the workflows category.
Last Updated: 2024-11-21
I was supposed to ship a few MB of JSON files to Project M. I created the files by printing the JSON to STDOUT and thought my job was done.
But luckily, before shipping, I decided to validate the JSON by running it through a lint tool:
$ yarn run jsonlint output/myevent.json
I discovered, luckily before shipping, that I had no commas between entries and therefore and data would be broken for input.
Always sanity check your data exports before handing it away (e.g. by importing the data to a DB, or parsing/linting)
prefer using JSON.write
type methods on the global data object rather than
iteratively printing the elements (since this approach omits the
between-element structure)