What is the correct MIME type?

3

In order to allow data to be exchanged between the server and the browser, a number of means are usually adopted, for example when returning an existing dataset in the database using JSON .

There are these here:

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

It turns out that I do not use any of them to work with data output of type JSON , usually using text/plain , which is for simple type returns.

What is the correct MIME Type for JSON ?

    
asked by anonymous 17.10.2015 / 02:12

1 answer

3

In general all of these will work, but the most semantic is application/json as RFC . Using the correct one, it makes it easier for all consumers to work properly - assuming that it is following the RFC.

There are situations where it can present problems, so do not discard the others. Each has a problem with some browser or some other application:)

    
17.10.2015 / 02:20