What is the correct JSON content type?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
35 views

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:

application/json
application/x-javascript
text/javascript
text/x-javascript
text/x-json

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

by (550 points) | 35 views

1 Answer

0 like 0 dislike

For JSON text:

application/json

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

For JSONP (runnable javascript) with callback:

application/javascript

by (1.2k points)

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
4 answers
0 like 0 dislike
2 answers
asked Jun 12, 2019 by s0prano
110,608 questions
257,186 answers
0 comments
28,105 users