Difference Between JSON Content Types

I know there is a question The correct JSON content type? but I am confused when to use the content type.

Therefore, the question arises: what are the differences between the different types of JSON content, and when should you prefer which one?

According to answers to similar questions about stackoverflow, application / json is the correct JSON content type, but then I thought, why are JSON content types still used, what is the reason?

+7
source share
2 answers

@Rndm, I'm glad you raised the question again. It made me review and confirm this for myself. Thanks.

Do not beat a dead horse, again. But on the net, there seems to be no consensus on what should be used as the JSON MIME type.

The specification clearly indicates only one type of MIME media for JSON, and this is " application / json " (see http://tools.ietf.org/html/rfc4627 , section "6. IANA Considerations").

However, it seems that in many cases browsers expect other types , and this is regrettable (see "I just struggled with IE8 for a long time with this, I found that if you load json in the iframe as text / plain"). Msgstr " What problems might occur when using a MIME application like / json?" , Norgg, November 27, 16:20).

+2
source

You should always use application/json . If someone who sends JSON expects something else, he does it wrong.

If you really need to communicate with someone who does it wrong, obviously you will have to play by your own rules - whatever they are.

+3
source

All Articles