Output this as your file:
JSON DATA
:)
You don't need HTML in there. Just your JSON data. You need to use PHP or an .htaccess file to provide the content-type header (must be done before outputting anything to the browser!). An HTML header I don't think will work as expected, as the content of the page is still HTML regardless of what you say it is. Regardless of content type, the actual content starts with HTML and so CTLR+S will save it with HTML content.
If using PHP, this file will work for you (save it as index.php and it will be the default when requesting a folder, as you requested in a comment on your question):
<?php header('Content-Type:application/json; charset=utf8'); ?>JSON DATA
You can put a linebreak after ?>
and before JSON DATA
if you prefer, PHP will ignore a single linebreak after a closing PHP tag.
This will make the browser detect the source is application/json, as opposed to interpreting it as an HTML file. However I suspect most browsers don't know what to do with a json file. If you want to force-download a file, (even suggesting a name like "my-amazing-file.json"), that can be done too: