JSON and JSONP correct MIME types

JSON (JavaScript Object Notation) and JSONP (JSON with padding) formats seems to be very similar, and therefore it might be very confusing which MIME type they should be using. Even though the formats seem to be very similar, there are some subtle differences between them.

But whenever you have any doubts, I have a straightforward solution (which works perfectly fine in most cases but sometimes might be a little bit time-consuming ;) ), namely, go and check corresponding RFC document.



RFC4627 (The application/json Media Type for JavaScript Object Notation (JSON)) is a specifications of JSON format. It says in section 6, that the MIME media type for JSON text is application/json.


JSONP (JSON with padding) is handled different way than JSON by a browser. JSONP is treated as a regular JavaScript script, and therefore it should use application/javascript, the current official MIME type for JavaScript. In many cases, however, text/javascript MIME type will work fine too.

Other MIME types

If you are looking for other MIME types, I would recommend checking Media Types document, which I personally find very useful.