Content-Disposition: attachment; filename=myfile.json
@RemiGrumeau What is 'not totally true'? Downloading files with browser is something completely different. The browser will probably default to expect HTML, so it assumes anything it receives is HTML unless otherwise specified. When downloading, it appends .html to the file, because that's what it defaults to.
The Content-Type header is just used as info for your application. The browser doesn't care what it is. The browser just returns you the data from the AJAX call. If you want to parse it as JSON, you need to do that on your own.
The header is there so your app can detect what data was returned and how it should handle it. You need to look at the header, and if it's application/json then parse it as JSON.
This is actually how jQuery works. If you don't tell it what to do with the result, it uses the Content-Type to detect what to do with it.