When trying to post json content to the asp.net core backend, the backend object is always null, and the network request is as follows:
{"draw":1,"columns":[{"data":"userName","name":"","searchable":true,"orderable":false,"search":{"value":"","regex":false}},{"data":"nickName","name":"","searchable": true,"orderable":false,"search":{"value":"","regex":false}},{"data":"deptCode","name":"","searchable":true,"orderable":false,"search":{"value":"","regex":false}},{" data":"_CreateTime","name":"","searchable":true,"orderable":false,"search":{"value":"","regex":false}},{"data":"disabled","name":"","searchable":true,"orderable": false,"search":{"value":"","regex":false}}],"order":[{"column":0,"dir":"asc"}],"start":0,"length":20,"search":{"value":"","regex":false},"SearchPar":{"userName":""}}
content-type: application/json; charset=UTF-8 The background code is as follows:
Changing the object to a simple type is acceptable normally, is it a generic problem? Finally, it was discovered that it seemed that the enum type was not receiving properly, causing the entire object to be null.
Solution:
Deserialize objects using NewtonsoftJson, defaultProbably soSystem.Text.Json。
The nuget command is as follows:
Startup modifications are as follows:
(End)
|