I’ve been messing around with JSON for some time, just pushing it out as text and it hasn’t hurt anybody (that 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 correct, 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.
Good Answer: 👌👌👌
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
- Internet Explorer sometimes has issues with
- A rather complete list of Mimetypes and what to use them for
Read More: 👉 https://stackoverflow.com/questions/477816/what-is-the-correct-json-content-type