How to get json format data without the .json or ?format=json postfix in the url?

I have tried to set the “Accept: application/json” header, but it
didn’t work. all i could get was the “406 Not Acceptable” status code.

Below was the command what i used to make the request:

curl -i -X POST -H “Content-Type: application/json” -H “Accept:
application/json” -d “{ title: "foo", body: "bar" }”

and here the result:

HTTP/1.1 406 Not Acceptable
Connection: close
Date: Mon, 21 Jul 2008 19:03:22 GMT
Status: 406 Not Acceptable
X-Runtime: 0.02510
Cache-Control: no-cache
Server: Mongrel 1.1.5
Content-Type: text/html; charset=utf-8
Content-Length: 1

if i use or,
i would get the proper result.