What is the correct JSON content type?

I have seen so many purported "standards" for the JSON content type:


But which is correct, or best? I gather that there are security and browser support issues varying between them.

asked Jun 3, 2015 in JAVASCRIPT by rajesh
0 votes

3 Answers

0 votes
For JSON text:

The MIME media type for JSON text is application/json. The default encoding is UTF-8. (Source: RFC 4627).
For JSONP with callback:

Here are some blog posts that were mentioned in the comments that are relevant.

Why you shouldn't use text/html for JSON
Internet Explorer sometimes has issues with application/json
A rather complete list of Mimetypes and what to use them for
answered Jun 3, 2015 by rajesh
0 votes

Content-Type: application/json

Content-Type: application/javascript
answered Jun 3, 2015 by rajesh
0 votes
Of course, the correct MIME media type for JSON is application/json, but it's necessary to realize what type of data is expected in your application.

For example, I use Ext GWT and the server response must go as text/html but contains JSON data.

Client side, Ext GWT form listener

uploadForm.getForm().addListener(new FormListenerAdapter()
    public void onActionFailed(Form form, int httpStatus, String responseText)

    public void onActionComplete(Form form, int httpStatus, String responseText)
In case of using application/json response type, the browser suggests me to save the file.

Server side source code snippet using Spring MVC

return new AbstractUrlBasedView()
    protected void renderMergedOutputModel(Map model, HttpServletRequest request,
                                           HttpServletResponse response) throws Exception
answered Jun 3, 2015 by rajesh