使用 curl 传递两个 json 参数

Passing two json parameters with curl

现在,我正在使用 curl 将参数传递到服务器端点。

这是我的要求:

curl --header "Content-Type: application/json" --request POST --data '{"item":"myItem1.txt"}' 0.0.0.0:5000/parse

如您所见,我只传递了一个参数,即myItem1。 现在,我处于一种情况,我想传递两个参数。 比方说,两个不同的项目。

我该怎么做,使用 curl?

加第二个属性:

curl --header "Content-Type: application/json" --request POST --data '{"item":"myItem1.txt", "otherItem": "myItem2.txt"}' 0.0.0.0:5000/parse

或项目数组

curl --header "Content-Type: application/json" --request POST --data '[{"item":"myItem1.txt"}, {"item":"myItem2.txt"}]' 0.0.0.0:5000/parse

或作为

curl --header "Content-Type: application/json" --request POST --data '{"item":["myItem1.txt", "myItem2.txt"]}' 0.0.0.0:5000/parse