JSON properties now lower case on swap from ASP .Net Core 1.0.0-rc2-final to 1.0.0

后端 未结 8 2114
逝去的感伤
逝去的感伤 2020-12-08 12:54

I\'ve just swapped our project from ASP .Net Core 1.0.0-rc2-final to 1.0.0. Our website and client have stopped working because of the capitalization of JSON properties. For

8条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-08 13:43

    For someone who does not want to set it globally, it is possible to use ContractResolver also to return as Json result:

    public IActionResult MyMethod()
    {
        var obj = new {myValue = 1};
        return Json(obj, new JsonSerializerSettings {ContractResolver = new DefaultContractResolver()});
    }
    

提交回复
热议问题