The *right* JSON content type?

Right I've been messing around with JSON for some time, just pushing it out as text and it hasn't hurt anybody (I know of), but I'd like to start doing things properly.

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


But which is right? Or best? I gather that there are security and browser support issues varying between them...

(I know there's a similar question, What MIME type if JSON is being returned by a REST API?, but I'd like a slightly more targeted answer.)


(get 1557 points)

The MIME media type for JSON text is application/json.
(get 192 points)

ANA has registered the official mimetype for JSON as "application/json".

See here:

More specifically here:

Douglas Crockford pointed to this document here:

When asked about why not "text/json", Crockford seems to have said JSON is not really javascript nor text and also IANA was more likely to hand out application/* than text/*


(get 57 points)

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 sourse code snippet using Spring MVC

return new AbstractUrlBasedView() {
protected void renderMergedOutputModel(Map model, HttpServletRequest request,
HttpServletResponse response) throws Exception {

overall reviews

Big image
refers the following website: