小编Ati*_*hav的帖子

JSON 值无法转换为 Newtonsoft.Json.Linq.JToken。路径:$ | 行号:1 | 字节位置内联:8

我有一个带有更新操作的 ASP.Net Core WebApi,如下所示:

   [HttpPut("{id}")]
    public async Task<IActionResult> Campaigns(long id, JObject jobject)
    {

    }
Run Code Online (Sandbox Code Playgroud)

当我从邮递员点击这个端点时的请求和响应如下:-

{
"Zone_Code": 1,
"State_Code": 24,
"City_Code": 25,
"Sales_Associate": null,
"Operation_Associate": null,
"Traveller": null,
"Target_Sector": 5,
"Campaign_DateTime": "2020-04-04T00:00:00",
"Format": 2,
"Campaign_Name": "Test",
"Data_Criteria": null,
"IsActive":"Y",
"Stage": "Initiation"
}


{
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"traceId": "|58a198b0-4ac4ca0838cdebce.",
"errors": {
    "$": [
        "The JSON value could not be converted to Newtonsoft.Json.Linq.JToken. Path: $ | LineNumber: 1 | BytePositionInLine: 8."
    ]
}}
Run Code Online (Sandbox Code Playgroud)

json.net

1
推荐指数
2
解决办法
6158
查看次数

标签 统计

json.net ×1