This is mostly just copied from shopify/ejson. I had some opinions on how the output format should look like so I needed to this.