4 ms·
This brings up something I'm waffling on. Whats the correct content type for JSON? in your example returning "Content-Type: text/plain; charset=UTF-8" which i
by sghael 16y ago
This brings up something I'm waffling on. Whats the correct content type for JSON?
in your example returning "Content-Type: text/plain; charset=UTF-8" which is nice because FF knows to render it in the browser (good for debugging atleast).
But votes on SO seem to indicate it should be
"application/json"
http://stackoverflow.com/questions/477816/the-right-json-content-type http://stackoverflow.com/questions/477816/the-right-json-con...
- dugmartin 16y agoUse application/json plus the JSONView Firefox plugin to get nice pretty printed json output.
- amitraman1 16y agoapplication/json
- alanh 16y agoThe correct content-type (MIME type) is indeed "application/json" (edit: downcased JSON, not sure why I made that typo). http://tools.ietf.org/html/rfc4627 http://tools.ietf.org/html/rfc4627 Additionally, if no encoding is specified, UTF-8 should be assumed when dealing with JSON.