curl 发送json请求

这个是在cmd环境下的输入:注意{\"userName\":\"helo\",\"id\":1}中间不能有空格

curl -H "Content-Type:application/json" -X POST --data {\"userName\":\"helo\",\"id\":1} http://localhost:8080/javabean/savejsonorder.json

 -H 后面必须用双引号包括Content-Type;

 在git bash环境下:

curl -H "Content-Type:application/json" -X POST --data '{"name":"a", "id":1 }' http://localhost:8000/post -s