added JSON output using the --json option

Not sure how to sensibly test this, let me know if you have some thoughts :)