linux中的curl命令

linux中的curl命令,linux,curl,ubuntu-14.04,Linux,Curl,Ubuntu 14.04,如何在curl命令中添加JSON参数来获取数据? PS:我尝试使用curl命令从某个源获取数据,但它需要在其中传递JSON参数。那么我将如何实现它呢?我认为将内容类型提到json并传递数据会做得很好 curl -H "Content-Type: application/json" -d '{"key1":"value1","key2":"value2"}' http://domain.com/rest/path/here 上述方法适用于GET方法,也适用于POST方法 curl -H "Co

如何在curl命令中添加JSON参数来获取数据?
PS:我尝试使用curl命令从某个源获取数据,但它需要在其中传递JSON参数。那么我将如何实现它呢?

我认为将内容类型提到json并传递数据会做得很好

curl -H "Content-Type: application/json" -d '{"key1":"value1","key2":"value2"}' http://domain.com/rest/path/here
上述方法适用于GET方法,也适用于POST方法

 curl -H "Content-Type: application/json" -X POST -d '{"key1":"value1","key2":"value2"}' http://domain.com/rest/path/here