Add the ability to output badges as JSON.

As discussed in issue #264, here is update to allow outputting badges as JSON. This took a little bit of "hackwork", since the entire system is designed to output images, not plain text. Nonetheless, it seems to work very well. Simply use `.json` a the file extension, and the data is returned as JSON. I've also added the CORS header right away as well.

Note, the "any badge" feature will not work with JSON, as that makes no sense.
(As a side-note, this function is exported, and there are projects out there that use this as an npm package, so breaking this function is a no-go.)