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

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

当前回答

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

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

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

features[title]
features[type]

看看下面的图片

其他回答

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

在我的例子中,我需要发送数组对象,我是这样发送的

这也适用于对象中的列表:

Id:37
IdParent:26
Name:Poplet
Values[0].Id:1349
Values[0].Name:SomeName
Values[1].Id:1350
Values[1].Name:AnotherName

等价的JSON是:

{
    "Id": 37,
    "IdParent": 26,
    "Name": "Poplet",
    "Values": [
        {
            "Id": 1349,
            "Name": "SomeName"
        },
        {
            "Id": 1350,
            "Name": "AnotherName"
        }
    ]
}

将Body设置为raw,并形成如下数组:

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

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

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

features[title]
features[type]

看看下面的图片