我一直在使用邮递员Chrome扩展来测试我的API,并想通过post发送一个id数组。有没有一种方法可以在Postman中将此作为参数发送?

{
  user_ids: ["1234", "5678"]
}

当前回答

{
    "data" : [  
        {
            "key1" : "value1",
            "key2" : "value2"   
        },
        {
            "key01" : "value01",
            "key02" : "value02"             
        },
        {
            "key10" : "value10",
            "key20" : "value20"   
        }
    ]
}

你可以这样通过。

其他回答

重要的是要知道,VALUE框只允许包含一个数值(不允许包含说明符)。

如果你想通过Postman发送一个“消息”数组,每个“消息”都有一个键/值对列表,在key框中输入messages[][reason],在value框中输入reason的值:

服务器将收到:

{"messages"=>[{"reason"=>"scrolled", "tabid"=>"2"}, {"reason"=>"reload", "tabid"=>"1"}], "endpoint"=>{}}

在报头集中

content-type : application/x-www-form-urlencoded

在body中选择选项

x-www-form-urlencoded

并插入数据作为json数组

user_ids : ["1234", "5678"]

假设你有下面的对象数组,

features: [
      {
        title: { type: String },
        type: { type: String },
      },
    ],

要在邮差的表单数据上添加值,请按以下方式添加

features[title]
features[type]

看看下面的图片

注:现在我们是在2022年,如果上面所有的解决方案都没有,不要惊慌。传递数组名称和不带括号的值,并将其添加多次,只需链接如下所示的图像。它应该可以正常工作。如果真的有用,请我喝杯咖啡

如果你想要一个字典数组,试试这个: