Hacker News new | ask | show | jobs
by sghael 5590 days 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-con...

3 comments

The 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

Additionally, if no encoding is specified, UTF-8 should be assumed when dealing with JSON.

Use application/json plus the JSONView Firefox plugin to get nice pretty printed json output.
application/json