content-type: multipart/form-data - What is the correct JSON content type?

content-type: text/html / json / http-headers / content-type

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

Alec



Answer #1

You'll notice that IANA.org doesn't list any of these other media types, in fact even application/javascript is now obsolete. So application/json is really the only possible correct answer.

The most widely supported non-standard media types are text/json or text/javascript. But some big names even use text/plain.

curl -I "https://ajax.googleapis.com/ajax/services/search/video?v=1.0&q=jsonexample"
curl -I "https://www.flickr.com/services/rest/?method=flickr.test.echo&format=json&api_key=f82254c1491d894f1204d8408f645a93"