Web API post 请求:Post([FromBody] JObject value) errors

    技术2022-07-11  130

    Web API post 请求:Post([FromBody] JObject value) errors:

    {     "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",     "title": "One or more validation errors occurred.",     "status": 400,     "traceId": "|bc8869df-4a1421febb7b9f25.",     "errors": {         "$": [             "The JSON value could not be converted to System.Collections.Generic.IEnumerable`1[Newtonsoft.Json.Linq.JToken]. Path: $ | LineNumber: 1 | BytePositionInLine: 15."         ]     } }

     

    public void ConfigureServices(IServiceCollection services)         {             services.AddCors();             services.AddControllers();             services.AddControllers().AddNewtonsoftJson();//注册服务             services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Latest);         }

     

    Processed: 0.027, SQL: 9