最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

Configuring JSON options in ASP.NET Core

2023-06-03 08:01 作者:Tuple_元組  | 我要投稿

如何格式化 JSON 對象中屬性的大小寫,不同的場景有如下變化:

In an ASP.NET Core application, you can configure the JSON serializer options used by controllers using the?AddJsonOptions?method:

This works well for controllers. .NET 6 introduced minimal APIs for hosting and routing in web applications. This is an easier way to create?small?web APIs. This new model does not use controllers, so you cannot use the?AddJsonOptions?method.?AddJsonOptions?configures?Microsoft.AspNetCore.Http.Json.JsonOptions?using the Dependency Injection (source). So, you can do the same directly. In the following example, I configure the JSON serializer options using the?Configure?method:

The JSON serializer uses the configuration settings

In .NET 6 preview 7, you can also provide the JSON serializer options using?Results.Json(object, JsonSerializerOptions)?(source):

ref:?https://www.meziantou.net/configuring-json-options-in-asp-net-core.htm

Configuring JSON options in ASP.NET Core的評論 (共 條)

分享到微博請遵守國家法律
九台市| 阿荣旗| 互助| 东明县| 钟祥市| 浦江县| 凤城市| 滨州市| 新安县| 武宣县| 错那县| 孟连| 龙江县| 政和县| 连云港市| 阜阳市| 福建省| 蛟河市| 青阳县| 石城县| 兰西县| 石楼县| 吴桥县| 吉首市| 登封市| 双城市| 边坝县| 青铜峡市| 隆林| 高清| 普定县| 穆棱市| 平利县| 栾城县| 邻水| 京山县| 保德县| 苍溪县| 辉县市| 怀来县| 贵阳市|