Added JSON data export option

Also renamed csv.php to export.php which accepts a parameter `filetype` that must be either `csv` or `json`.