What is the exact difference between content-type: text/json and application/json?

application/json: Official MIME type for json

text/x-json: Experimental(unofficial) MIME type for json before application/json got officially registered


From the definitions of Content-Type:

Two of the seven standard initial predefined Content-Types are:

  • text: textual information. The primary subtype, "plain", indicates plain (unformatted) text. No special software is required to get the full meaning of the text, aside from support for the indicated character set. Subtypes are to be used for enriched text in forms where application software may enhance the appearance of the text, but such software must not be required in order to get the general idea of the content. Possible subtypes thus include any readable word processor format. A very simple and portable subtype, richtext, is defined in this document.
  • application: some other kind of data, typically either uninterpreted binary data or information to be processed by a mail-based application. The primary subtype, "octet-stream", is to be used in the case of uninterpreted binary data, in which case the simplest recommended action is to offer to write the information into a file for the user. Two additional subtypes, "ODA" and "PostScript", are defined for transporting ODA and PostScript documents in bodies. Other expected uses for "application" include spreadsheets, data for mail-based scheduling systems, and languages for "active" (computational) email.

(emphasis mine)

In other words:

  • text if it is readable text (which JSON is)
  • application if its unreadable binary data (which JSON is not)

Ideally it would be text/json, but Douglas Crockford registered application/json:

Applications that use this media type: JSON has been used to exchange data between applications written in all of these programming languages: ActionScript, C, C#, Clojure, ColdFusion, Common Lisp, E, Erlang, Go, Java, JavaScript, Lua, Objective CAML, Perl, PHP, Python, Rebol, Ruby, Scala, and Scheme.

So why did he register it under application rather than the correct text?

Originally it was text/json. In his first January 2006 draft:

5. IANA Considerations

The MIME media type for JSON text is text/json.

And in his 1st, 2nd, and 3rd revisions it was still text/json. But by his 4th revision in February 2006, he changed it to application/json (with typos):

6. IANA Considerations

The MIME media type for JSON text is application/json.

Type name: text

Subtype name: json

By the time it was accepted as a full RFC in July 2006, all the typos of text were gone:

  1. IANA Considerations

The MIME media type for JSON text is application/json.

Type name: application

Subtype name: json

Apparently the reason for the change from text/json to application/json is that the IANA was more likely to hand out an application/* rather than text/* assignment.