【发布时间】:2021-04-05 19:18:21
【问题描述】:
邮递员中我的 Json [Body] 结构如下所示
[{
"SerialNumber": "dev1",
"CustomerId": "cust1",
"Seed": "c393d900-2f25-819f-cc83-0721357bcf10",
"BitLockerKey": null,
"bitLockerRecoveryKey": null
},
{
"SerialNumber": "dev2",
"CustomerId": "cust2",
"Seed": "c393d900-2f25-819f-cc83-0721357bcf22",
"BitLockerKey": null,
"bitLockerRecoveryKey": null
}]
我的web api函数如下,
[HttpPost]
public ActionResult<string> SaveData([FromBody] string Data)
{
int result = _seedService.SeedGeneration(Data);
return result > 0 ? Ok(result) : (ActionResult<string>)UnprocessableEntity("Seed generation
Failed");
}
我的问题是,如何在邮递员中使用 json 数组结构将数据作为字符串传递。我收到错误“无法将 JSON 值转换为 System.string
【问题讨论】:
标签: json asp.net-web-api postman