Difference between JSON content types
You should always use application/json
. If whoever you're sending the JSON to expects something else, they're doing it wrong.
That being said, if you really need to communicate with someone who's doing it wrong, obviously you'll have to play by their rules - whatever those may be.
@Rndm, I'm glad you raised the issue again. It caused me to review and reaffirm it for myself. Thank you.
Not to beat a dead horse, again. But there seems to be precious little consensus on the net about what should be used as the JSON MIME type.
The spec lists clearly only one MIME media type for JSON and it is "application/json" (see http://tools.ietf.org/html/rfc4627, section "6. IANA Considerations".
However, there seems to be many cases where browsers are expecting other types, and this is unfortunate (see "Having just had a long fight with IE8 myself with this I found that if you're loading the json into an iframe as text/plain", What problems may using the MIME type application/json cause?, Norgg Nov 27 at 16:20).