What is the correct MIME type?

Asked

Viewed 344 times

3

To allow the exchange of data between the server and the browser, usually several media are adopted, for example when one wants to return a set of data existent in the database using data of type JSON.

There are these:

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

Turns out I don’t use any of them to work with data outputs like JSON, normally use text/plain, which is for simple text type returns.

What is the Correct MIME Type for JSON ?

1 answer

3


In general all these will work but the most semantic is the application/json in accordance with RFC. Using the right one, it’s easier for all consumers to work correctly - assuming that they are following RFC.

There are situations he might have problems with, so don’t dismiss the others. Each has a problem with some browser or other application :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.