"use strict";(self.webpackChunkfurion=self.webpackChunkfurion||[]).push([[5434],{7039:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>d,contentTitle:()=>t,default:()=>j,frontMatter:()=>l,metadata:()=>c,toc:()=>a});var r=s(5893),i=s(1151),o=s(510);const l={id:"json-serialization",title:"23. JSON \u5e8f\u5217\u5316",sidebar_label:"23. JSON \u5e8f\u5217\u5316"},t=void 0,c={id:"json-serialization",title:"23. JSON \u5e8f\u5217\u5316",description:"\ud83d\udcdd \u6a21\u5757\u66f4\u65b0\u65e5\u5fd7",source:"@site/docs/json-serialization.mdx",sourceDirName:".",slug:"/json-serialization",permalink:"/docs/json-serialization",draft:!1,unlisted:!1,editUrl:"https://gitee.com/dotnetchina/Furion/tree/v4/handbook/docs/json-serialization.mdx",tags:[],version:"current",lastUpdatedBy:"\u767e\u5c0f\u50e7",lastUpdatedAt:1700452034,formattedLastUpdatedAt:"Nov 20, 2023",frontMatter:{id:"json-serialization",title:"23. JSON \u5e8f\u5217\u5316",sidebar_label:"23. JSON \u5e8f\u5217\u5316"},sidebar:"docs",previous:{title:"22. \u4e8b\u4ef6\u603b\u7ebf (EventBus)",permalink:"/docs/event-bus"},next:{title:"24. \u5373\u65f6\u901a\u8baf",permalink:"/docs/signalr"}},d={},a=[{value:"23.1 \u4ec0\u4e48\u662f JSON",id:"231-\u4ec0\u4e48\u662f-json",level:2},{value:"23.2 \u5173\u4e8e\u5e8f\u5217\u5316\u5e93",id:"232-\u5173\u4e8e\u5e8f\u5217\u5316\u5e93",level:2},{value:"23.3 IJsonSerializerProvider \u63a5\u53e3",id:"233-ijsonserializerprovider-\u63a5\u53e3",level:2},{value:"23.4 \u5982\u4f55\u4f7f\u7528",id:"234-\u5982\u4f55\u4f7f\u7528",level:2},{value:"23.4.1 \u83b7\u53d6\u5e8f\u5217\u5316\u5bf9\u8c61",id:"2341-\u83b7\u53d6\u5e8f\u5217\u5316\u5bf9\u8c61",level:3},{value:"23.4.2 \u5e8f\u5217\u5316\u5bf9\u8c61",id:"2342-\u5e8f\u5217\u5316\u5bf9\u8c61",level:3},{value:"23.4.3 \u53cd\u5e8f\u5217\u5316\u5b57\u7b26\u4e32",id:"2343-\u53cd\u5e8f\u5217\u5316\u5b57\u7b26\u4e32",level:3},{value:"23.4.4 \u5e8f\u5217\u5316\u66f4\u591a\u914d\u7f6e",id:"2344-\u5e8f\u5217\u5316\u66f4\u591a\u914d\u7f6e",level:3},{value:"23.5 \u9ad8\u7ea7\u7528\u6cd5",id:"235-\u9ad8\u7ea7\u7528\u6cd5",level:2},{value:"23.5.1 \u81ea\u5b9a\u4e49\u5e8f\u5217\u5316\u63d0\u4f9b\u5668",id:"2351-\u81ea\u5b9a\u4e49\u5e8f\u5217\u5316\u63d0\u4f9b\u5668",level:3},{value:"23.5.2 \u5e8f\u5217\u5316\u5c5e\u6027\u540d\u5927\u5199\uff08\u5c5e\u6027\u539f\u6837\u8f93\u51fa\uff09",id:"2352-\u5e8f\u5217\u5316\u5c5e\u6027\u540d\u5927\u5199\u5c5e\u6027\u539f\u6837\u8f93\u51fa",level:3},{value:"23.5.3 \u65f6\u95f4\u683c\u5f0f\u5316\uff08\u65f6\u95f4\u6233\u8f6c\u65f6\u95f4\uff09",id:"2353-\u65f6\u95f4\u683c\u5f0f\u5316\u65f6\u95f4\u6233\u8f6c\u65f6\u95f4",level:3},{value:"23.5.4 \u5ffd\u7565\u5faa\u73af\u5f15\u7528",id:"2354-\u5ffd\u7565\u5faa\u73af\u5f15\u7528",level:3},{value:"23.5.5 \u5305\u542b\u6210\u5458\u5b57\u6bb5\u5e8f\u5217\u5316",id:"2355-\u5305\u542b\u6210\u5458\u5b57\u6bb5\u5e8f\u5217\u5316",level:3},{value:"23.5.6 \u5141\u8bb8\u5c3e\u968f\u9017\u53f7",id:"2356-\u5141\u8bb8\u5c3e\u968f\u9017\u53f7",level:3},{value:"23.5.7 \u5141\u8bb8\u6ce8\u91ca",id:"2357-\u5141\u8bb8\u6ce8\u91ca",level:3},{value:"23.5.8 \u5904\u7406\uff08\u4e2d\u6587\uff09\u4e71\u7801\u95ee\u9898",id:"2358-\u5904\u7406\u4e2d\u6587\u4e71\u7801\u95ee\u9898",level:3},{value:"23.5.9 \u4e0d\u533a\u5206\u5927\u5c0f\u5199",id:"2359-\u4e0d\u533a\u5206\u5927\u5c0f\u5199",level:3},{value:"23.5.10 \u5ffd\u7565\u7279\u5b9a\u5c5e\u6027\u5e8f\u5217\u5316",id:"23510-\u5ffd\u7565\u7279\u5b9a\u5c5e\u6027\u5e8f\u5217\u5316",level:3},{value:"23.5.11 \u52a8\u6001\u5bf9\u8c61\u5c5e\u6027\u540d\u5927\u5199\u95ee\u9898",id:"23511-\u52a8\u6001\u5bf9\u8c61\u5c5e\u6027\u540d\u5927\u5199\u95ee\u9898",level:3},{value:"23.5.12 \u5ffd\u7565\u6240\u6709 null \u5c5e\u6027",id:"23512-\u5ffd\u7565\u6240\u6709-null-\u5c5e\u6027",level:3},{value:"23.5.13 \u5ffd\u7565\u6240\u6709\u9ed8\u8ba4\u503c\u5c5e\u6027",id:"23513-\u5ffd\u7565\u6240\u6709\u9ed8\u8ba4\u503c\u5c5e\u6027",level:3},{value:"23.5.14 \u63a7\u5236\u5c5e\u6027\u5e8f\u5217\u5316\u987a\u5e8f",id:"23514-\u63a7\u5236\u5c5e\u6027\u5e8f\u5217\u5316\u987a\u5e8f",level:3},{value:"23.5.15 \u91cd\u547d\u540d\u5e8f\u5217\u5316\u540d\u79f0\uff08\u5c5e\u6027\u540d\u79f0\uff09",id:"23515-\u91cd\u547d\u540d\u5e8f\u5217\u5316\u540d\u79f0\u5c5e\u6027\u540d\u79f0",level:3},{value:"23.5.16 JSON \u5b57\u7b26\u4e32\u7f29\u8fdb",id:"23516-json-\u5b57\u7b26\u4e32\u7f29\u8fdb",level:3},{value:"23.5.17 long \u7c7b\u578b\u5e8f\u5217\u5316\u65f6\u8f6c string",id:"23517-long-\u7c7b\u578b\u5e8f\u5217\u5316\u65f6\u8f6c-string",level:3},{value:"23.5.18 DateOnly \u548c TimeOnly \u7c7b\u578b\u5e8f\u5217\u5316\u652f\u6301",id:"23518-dateonly-\u548c-timeonly-\u7c7b\u578b\u5e8f\u5217\u5316\u652f\u6301",level:3},{value:"23.5.19 \u7c98\u571f\u5bf9\u8c61 Clay \u7c7b\u578b\u5e8f\u5217\u5316\u652f\u6301",id:"23519-\u7c98\u571f\u5bf9\u8c61-clay-\u7c7b\u578b\u5e8f\u5217\u5316\u652f\u6301",level:3},{value:"23.5.20 DateTimeOffset \u53cd\u5e8f\u5217\u5316\u5f02\u5e38",id:"23520-datetimeoffset-\u53cd\u5e8f\u5217\u5316\u5f02\u5e38",level:3},{value:"23.5.21 \u7ee7\u627f/\u6d3e\u751f\u7c7b\u5e8f\u5217\u5316\u95ee\u9898",id:"23521-\u7ee7\u627f\u6d3e\u751f\u7c7b\u5e8f\u5217\u5316\u95ee\u9898",level:3},{value:"23.5.22 \u679a\u4e3e\u548c\u5b57\u7b26\u4e32\u4e92\u8f6c\u95ee\u9898",id:"23522-\u679a\u4e3e\u548c\u5b57\u7b26\u4e32\u4e92\u8f6c\u95ee\u9898",level:3},{value:"23.6 DataTable\u3001DataSet\u3001Tuple \u3001JArray\uff0cJObject\uff0cJToken \u7b49\u5e8f\u5217\u5316\u95ee\u9898",id:"236-datatabledatasettuple-jarrayjobjectjtoken-\u7b49\u5e8f\u5217\u5316\u95ee\u9898",level:2},{value:"23.7 System.Text.Json \u548c Newtonsoft.Json \u5b8c\u6574\u5dee\u5f02\u5316\u5bf9\u6bd4",id:"237-systemtextjson-\u548c-newtonsoftjson-\u5b8c\u6574\u5dee\u5f02\u5316\u5bf9\u6bd4",level:2},{value:"23.8 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"238-\u53cd\u9988\u4e0e\u5efa\u8bae",level:2}];function h(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",h2:"h2",h3:"h3",li:"li",mdxAdmonitionTitle:"mdxAdmonitionTitle",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,i.a)(),...e.components},{Details:s}=n;return s||function(e,n){throw new Error("Expected "+(n?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("Details",!0),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(s,{children:[(0,r.jsx)("summary",{children:"\ud83d\udcdd \u6a21\u5757\u66f4\u65b0\u65e5\u5fd7"}),(0,r.jsx)("div",{children:(0,r.jsxs)("div",{children:[(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"\u65b0\u7279\u6027"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\xa0",(0,r.jsx)(o.Z,{children:"\u65b0\u589e"})," \u65f6\u95f4\u6233\u6a21\u578b\u7ed1\u5b9a\u5668\u5c06\u65f6\u95f4\u6233\u8f6c\u6362\u4e3a ",(0,r.jsx)(n.code,{children:"DateTime/DateTimeOffset"})," \u7c7b\u578b ",(0,r.jsx)("sup",{children:"4.9.1.5"})," ",(0,r.jsx)("sup",{children:"\u23f1\ufe0f2023.11.20"})," ",(0,r.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/commit/df3053cf081d5e4d8eb63d567ed95c45267e0969",children:"df3053c"})]}),"\n",(0,r.jsxs)(n.li,{children:["\xa0",(0,r.jsx)(o.Z,{children:"\u65b0\u589e"})," ",(0,r.jsx)(n.code,{children:"Newtonsoft.Json"})," \u81ea\u52a8\u5c06\u65f6\u95f4\u6233\u8f6c\u6362\u4e3a ",(0,r.jsx)(n.code,{children:"DateTime/DateTimeOffset"})," \u7c7b\u578b ",(0,r.jsx)("sup",{children:"4.9.1.3"})," ",(0,r.jsx)("sup",{children:"\u23f1\ufe0f2023.11.17"})," ",(0,r.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/commit/78a589d99eb5985b576e4c96acd6e4890391d6ff",children:"78a589d"})]}),"\n",(0,r.jsxs)(n.li,{children:["\xa0",(0,r.jsx)(o.Z,{children:"\u65b0\u589e"})," ",(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u81ea\u52a8\u5c06\u65f6\u95f4\u6233\u8f6c\u6362\u4e3a ",(0,r.jsx)(n.code,{children:"DateTime/DateTimeOffset"})," \u7c7b\u578b ",(0,r.jsx)("sup",{children:"4.9.1.2"})," ",(0,r.jsx)("sup",{children:"\u23f1\ufe0f2023.11.17"})," ",(0,r.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/commit/abd5196f5c5160a5df96dad80c7c5aa51b96d5b9",children:"abd5196"})]}),"\n",(0,r.jsxs)(n.li,{children:["\xa0",(0,r.jsx)(o.Z,{children:"\u65b0\u589e"})," ",(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u548c ",(0,r.jsx)(n.code,{children:"Newtonsoft.Json"})," \u5bf9\u7c98\u571f\u5bf9\u8c61 ",(0,r.jsx)(n.code,{children:"Clay"})," \u652f\u6301 ",(0,r.jsx)("sup",{children:"4.8.8.1"})," ",(0,r.jsx)("sup",{children:"\u23f1\ufe0f2023.04.18"})," ",(0,r.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/I6WKRZ",children:"#I6WKRZ"})]}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"\u7a81\u7834\u6027\u53d8\u5316"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\xa0",(0,r.jsx)(o.Z,{children:"\u8c03\u6574"})," ",(0,r.jsxs)(n.strong,{children:[(0,r.jsx)(n.code,{children:"IJsonSerializerProvider"})," \u5e8f\u5217\u5316\u63a5\u53e3\uff0c\u6dfb\u52a0 ",(0,r.jsx)(n.code,{children:"Deserialize"})," \u53cd\u5e8f\u5217\u5316\u65b9\u6cd5"]})," ",(0,r.jsx)("sup",{children:"4.8.8.15"})," ",(0,r.jsx)("sup",{children:"\u23f1\ufe0f2023.05.15"})," ",(0,r.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/pulls/815",children:"!815"})," \u611f\u8c22 ",(0,r.jsx)(n.a,{href:"https://gitee.com/YaChengMu",children:"@YaChengMu"})]}),"\n"]}),"\n"]}),"\n"]}),(0,r.jsxs)(s,{style:{marginLeft:50},children:[(0,r.jsx)("summary",{children:"\u67e5\u770b\u53d8\u5316"}),(0,r.jsxs)("div",{children:[(0,r.jsxs)(n.p,{children:["\u6dfb\u52a0 ",(0,r.jsx)(n.code,{children:"25-32\u884c"})," \u63a5\u53e3\u65b9\u6cd5\uff1a"]}),(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {25-32}",children:'namespace Furion.JsonSerialization;\r\n\r\n/// \r\n/// Json \u5e8f\u5217\u5316\u63d0\u4f9b\u5668\r\n/// \r\npublic interface IJsonSerializerProvider\r\n{\r\n /// \r\n /// \u5e8f\u5217\u5316\u5bf9\u8c61\r\n /// \r\n /// \r\n /// \r\n /// \r\n string Serialize(object value, object jsonSerializerOptions = default);\r\n\r\n /// \r\n /// \u53cd\u5e8f\u5217\u5316\u5b57\u7b26\u4e32\r\n /// \r\n /// \r\n /// \r\n /// \r\n /// \r\n T Deserialize(string json, object jsonSerializerOptions = default);\r\n\r\n /// \r\n /// \u53cd\u5e8f\u5217\u5316\u5b57\u7b26\u4e32\r\n /// \r\n /// \r\n /// \r\n /// \r\n /// \r\n object Deserialize(string json, Type returnType, object jsonSerializerOptions = default);\r\n\r\n /// \r\n /// \u8fd4\u56de\u8bfb\u53d6\u5168\u5c40\u914d\u7f6e\u7684 JSON \u9009\u9879\r\n /// \r\n /// \r\n object GetSerializerOptions();\r\n}\n'})}),(0,r.jsxs)(n.p,{children:["\u5982\u679c\u4f7f\u7528 ",(0,r.jsx)(n.code,{children:"Newtonsoft.Json"})," \u5219\u53ea\u9700\u6dfb\u52a0\u4ee5\u4e0b\u5b9e\u73b0\u5373\u53ef\uff1a"]}),(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {8-11}",children:'/// \r\n/// \u53cd\u5e8f\u5217\u5316\u5b57\u7b26\u4e32\r\n/// \r\n/// \r\n/// \r\n/// \r\n/// \r\npublic object Deserialize(string json, Type returnType, object jsonSerializerOptions = null)\r\n{\r\n return JsonConvert.DeserializeObject(json, returnType, (jsonSerializerOptions ?? GetSerializerOptions()) as JsonSerializerSettings);\r\n}\n'})})]})]})]})})]}),"\n",(0,r.jsx)(n.admonition,{title:"\u7248\u672c\u8bf4\u660e",type:"important",children:(0,r.jsxs)(n.p,{children:["\u4ee5\u4e0b\u5185\u5bb9\u4ec5\u9650 ",(0,r.jsx)(n.code,{children:"Furion 1.16.0 +"})," \u7248\u672c\u4f7f\u7528\u3002"]})}),"\n",(0,r.jsxs)(n.h2,{id:"231-\u4ec0\u4e48\u662f-json",children:["23.1 \u4ec0\u4e48\u662f ",(0,r.jsx)(n.code,{children:"JSON"})]}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:"JSON (JavaScript Object Notation, JS \u5bf9\u8c61\u6807\u8bb0) \u662f\u4e00\u79cd\u8f7b\u91cf\u7ea7\u7684\u6570\u636e\u4ea4\u6362\u683c\u5f0f\u3002\u5b83\u57fa\u4e8e ECMAScript (w3c \u5236\u5b9a\u7684 js \u89c4\u8303)\u7684\u4e00\u4e2a\u5b50\u96c6\uff0c\u91c7\u7528\u5b8c\u5168\u72ec\u7acb\u4e8e\u7f16\u7a0b\u8bed\u8a00\u7684\u6587\u672c\u683c\u5f0f\u6765\u5b58\u50a8\u548c\u8868\u793a\u6570\u636e\u3002\u7b80\u6d01\u548c\u6e05\u6670\u7684\u5c42\u6b21\u7ed3\u6784\u4f7f\u5f97 JSON \u6210\u4e3a\u7406\u60f3\u7684\u6570\u636e\u4ea4\u6362\u8bed\u8a00\u3002 \u6613\u4e8e\u4eba\u9605\u8bfb\u548c\u7f16\u5199\uff0c\u540c\u65f6\u4e5f\u6613\u4e8e\u673a\u5668\u89e3\u6790\u548c\u751f\u6210\uff0c\u5e76\u6709\u6548\u5730\u63d0\u5347\u7f51\u7edc\u4f20\u8f93\u6548\u7387\u3002"}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"\u7b80\u5355\u6765\u8bf4\uff0cJSON\uff0c\u662f\u4e00\u79cd\u6570\u636e\u683c\u5f0f\uff0c\u5728\u4e0e\u540e\u7aef\u7684\u6570\u636e\u4ea4\u4e92\u4e2d\u6709\u8f83\u4e3a\u5e7f\u6cdb\u7684\u5e94\u7528\u3002"}),"\n",(0,r.jsx)(n.h2,{id:"232-\u5173\u4e8e\u5e8f\u5217\u5316\u5e93",children:"23.2 \u5173\u4e8e\u5e8f\u5217\u5316\u5e93"}),"\n",(0,r.jsxs)(n.p,{children:["\u76ee\u524d\u5728 C# \u8bed\u8a00\u4e2d\u6709\u4e24\u4e2a\u4e3b\u6d41\u7684 ",(0,r.jsx)(n.code,{children:"JSON"})," \u5e8f\u5217\u5316\u64cd\u4f5c\u5e93\uff1a"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"System.Text.Json"}),"\uff1a",(0,r.jsx)(n.code,{children:".NET Core"})," \u5185\u7f6e ",(0,r.jsx)(n.code,{children:"JSON"})," \u5e8f\u5217\u5316\u5e93\uff0c\u4e5f\u662f ",(0,r.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u9ed8\u8ba4\u5b9e\u73b0"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Newtonsoft.Json"}),"\uff1a\u76ee\u524d\u4f7f\u7528\u4eba\u6570\u6700\u591a\u7684 ",(0,r.jsx)(n.code,{children:"JSON"})," \u5e8f\u5217\u5316\u5e93\uff0c\u9700\u8981\u5b89\u88c5 ",(0,r.jsx)(n.code,{children:"Microsoft.AspNetCore.Mvc.NewtonsoftJson"})," \u62d3\u5c55\u5305"]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["\u7531\u4e8e\u76ee\u524d ",(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u76f8\u6bd4 ",(0,r.jsx)(n.code,{children:"Newtonsoft.Json"})," \u529f\u80fd\u548c\u7a33\u5b9a\u6027\u6709\u8bb8\u591a\u4e0d\u8db3\u4e4b\u5904\uff0c\u6bd4\u5982\u5faa\u73af\u5f15\u7528\u95ee\u9898\u5728 ",(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u65e0\u89e3\u3002\u4f46\u5728 ",(0,r.jsx)(n.code,{children:".NET 6"})," \u4e4b\u540e\u5f97\u5230\u89e3\u51b3\u3002"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u4e3a\u4e86\u89e3\u51b3\u591a\u79cd\u5e8f\u5217\u5316\u5de5\u5177\u914d\u7f6e\u548c\u7528\u6cd5\u4e0a\u7684\u5dee\u5f02\u95ee\u9898\uff0c\u62bd\u8c61\u51fa\u4e86 ",(0,r.jsx)(n.code,{children:"IJsonSerializerProvider"})," \u63a5\u53e3\u3002"]}),"\n",(0,r.jsxs)(n.h2,{id:"233-ijsonserializerprovider-\u63a5\u53e3",children:["23.3 ",(0,r.jsx)(n.code,{children:"IJsonSerializerProvider"})," \u63a5\u53e3"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u63d0\u4f9b\u4e86 ",(0,r.jsx)(n.code,{children:"IJsonSerializerProvider"})," \u63a5\u53e3\u89c4\u8303\uff0c\u540c\u65f6",(0,r.jsx)(n.strong,{children:"\u8981\u6c42\u5b9e\u73b0\u8be5\u63a5\u53e3\u7684\u5b9e\u4f53\u90fd\u5fc5\u987b\u91c7\u7528\u5355\u4f8b\u6a21\u5f0f"}),"\uff0c\u8be5\u63a5\u53e3\u5b9a\u4e49\u4ee3\u7801\u5982\u4e0b\uff1a"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:'namespace Furion.JsonSerialization;\r\n\r\n/// \r\n/// Json \u5e8f\u5217\u5316\u63d0\u4f9b\u5668\r\n/// \r\npublic interface IJsonSerializerProvider\r\n{\r\n /// \r\n /// \u5e8f\u5217\u5316\u5bf9\u8c61\r\n /// \r\n /// \r\n /// \r\n /// \r\n string Serialize(object value, object jsonSerializerOptions = default);\r\n\r\n /// \r\n /// \u53cd\u5e8f\u5217\u5316\u5b57\u7b26\u4e32\r\n /// \r\n /// \r\n /// \r\n /// \r\n /// \r\n T Deserialize(string json, object jsonSerializerOptions = default);\r\n\r\n /// \r\n /// \u53cd\u5e8f\u5217\u5316\u5b57\u7b26\u4e32\r\n /// \r\n /// \r\n /// \r\n /// \r\n /// \r\n object Deserialize(string json, Type returnType, object jsonSerializerOptions = default);\r\n\r\n /// \r\n /// \u8fd4\u56de\u8bfb\u53d6\u5168\u5c40\u914d\u7f6e\u7684 JSON \u9009\u9879\r\n /// \r\n /// \r\n object GetSerializerOptions();\r\n}\n'})}),"\n",(0,r.jsx)(n.admonition,{title:"\u9ed8\u8ba4\u5b9e\u73b0",type:"important",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"SystemTextJsonSerializerProvider"})," \u7c7b\u662f ",(0,r.jsx)(n.code,{children:"IJsonSerializerProvider"})," \u63a5\u53e3\u7684\u9ed8\u8ba4\u5b9e\u73b0\uff0c\u5728\u5e94\u7528\u542f\u52a8\u65f6\u5df2\u9ed8\u8ba4\u6ce8\u518c\u3002"]})}),"\n",(0,r.jsx)(n.h2,{id:"234-\u5982\u4f55\u4f7f\u7528",children:"23.4 \u5982\u4f55\u4f7f\u7528"}),"\n",(0,r.jsx)(n.h3,{id:"2341-\u83b7\u53d6\u5e8f\u5217\u5316\u5bf9\u8c61",children:"23.4.1 \u83b7\u53d6\u5e8f\u5217\u5316\u5bf9\u8c61"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u63d0\u4f9b\u4e86\u4e24\u79cd\u65b9\u5f0f\u83b7\u53d6 ",(0,r.jsx)(n.code,{children:"IJsonSerializerProvider"})," \u5b9e\u4f8b\uff1a"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\u6784\u9020\u51fd\u6570\u6ce8\u5165 ",(0,r.jsx)(n.code,{children:"IJsonSerializerProvider"})]}),"\n",(0,r.jsxs)(n.li,{children:["\u9759\u6001\u7c7b ",(0,r.jsx)(n.code,{children:"JSON.GetJsonSerializer()"})," \u65b9\u5f0f\uff0c",(0,r.jsxs)(n.strong,{children:["\u67e5\u770b ",(0,r.jsx)(n.a,{href:"/docs/global/json",children:"JSON \u9759\u6001\u7c7b"})]})]}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"\u5982\uff1a"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {10,13}",children:"using Furion.DynamicApiController;\r\nusing Furion.JsonSerialization;\r\n\r\nnamespace Furion.Application\r\n{\r\n public class JsonDemo : IDynamicApiController\r\n {\r\n private readonly IJsonSerializerProvider _jsonSerializer;\r\n private readonly IJsonSerializerProvider _jsonSerializer2;\r\n public JsonDemo(IJsonSerializerProvider jsonSerializer)\r\n {\r\n _jsonSerializer = jsonSerializer;\r\n _jsonSerializer2 = JSON.GetJsonSerializer();\r\n }\r\n }\r\n}\n"})}),"\n",(0,r.jsx)(n.h3,{id:"2342-\u5e8f\u5217\u5316\u5bf9\u8c61",children:"23.4.2 \u5e8f\u5217\u5316\u5bf9\u8c61"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:'public string GetText()\r\n{\r\n return _jsonSerializer.Serialize(new\r\n {\r\n Id = 1,\r\n Name = "Furion"\r\n });\r\n}\n'})}),"\n",(0,r.jsx)(n.h3,{id:"2343-\u53cd\u5e8f\u5217\u5316\u5b57\u7b26\u4e32",children:"23.4.3 \u53cd\u5e8f\u5217\u5316\u5b57\u7b26\u4e32"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:'public object GetObject()\r\n{\r\n var json = "{\\"Id\\":1,\\"Name\\":\\"Furion\\"}";\r\n var obj = _jsonSerializer.Deserialize(json);\r\n return obj;\r\n}\n'})}),"\n",(0,r.jsxs)(n.admonition,{title:"\u7279\u522b\u6ce8\u610f",type:"important",children:[(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u9ed8\u8ba4\u53cd\u5e8f\u5217\u5316\u5927\u5c0f\u5199\u654f\u611f\uff0c\u4e5f\u5c31\u662f\u4e0d\u5b8c\u5168\u5339\u914d\u7684\u5c5e\u6027\u540d\u79f0\u4e0d\u4f1a\u81ea\u52a8\u8d4b\u503c\u3002\u8fd9\u65f6\u5019\u6211\u4eec\u53ef\u4ee5\u5168\u5c40\u914d\u7f6e\u6216\u5355\u72ec\u914d\u7f6e\u3002"]}),(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"\u5168\u5c40\u914d\u7f6e"}),"\n"]}),(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"services.AddControllersWithViews()\r\n .AddJsonOptions(options => {\r\n options.JsonSerializerOptions.PropertyNameCaseInsensitive = true;\r\n });\n"})}),(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"\u5355\u72ec\u914d\u7f6e"}),"\n"]}),(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"var obj = _jsonSerializer.Deserialize(json, new JsonSerializerOptions\r\n {\r\n PropertyNameCaseInsensitive = true\r\n });\n"})})]}),"\n",(0,r.jsx)(n.h3,{id:"2344-\u5e8f\u5217\u5316\u66f4\u591a\u914d\u7f6e",children:"23.4.4 \u5e8f\u5217\u5316\u66f4\u591a\u914d\u7f6e"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u4e0d\u63a8\u8350\u4e00\u4e2a\u6846\u67b6\u4e2d\u6709\u591a\u79cd\u5e8f\u5217\u5316\u5b9e\u73b0\u7c7b\uff0c\u4e5f\u5c31\u662f\u8bf4\u4f7f\u7528 ",(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u5c31\u4e0d\u8981\u4f7f\u7528 ",(0,r.jsx)(n.code,{children:"Newtonsoft.Json"}),"\uff0c\u53cd\u4e4b\u4ea6\u7136\u3002"]}),"\n",(0,r.jsxs)(n.p,{children:["\u5982\u9700\u914d\u7f6e\u66f4\u591a\u9009\u9879\uff0c\u53ea\u9700\u521b\u5efa ",(0,r.jsx)(n.code,{children:"JsonSerializerOptions"})," \u914d\u7f6e\u5bf9\u8c61\u5373\u53ef\uff0c\u5982\uff1a"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {5}",children:'var json = _jsonSerializer.Serialize(new\r\n {\r\n Id = 1,\r\n Name = "Furion"\r\n }, new JsonSerializerOptions {\r\n WriteIndented = true\r\n });\n'})}),"\n",(0,r.jsx)(n.h2,{id:"235-\u9ad8\u7ea7\u7528\u6cd5",children:"23.5 \u9ad8\u7ea7\u7528\u6cd5"}),"\n",(0,r.jsx)(n.h3,{id:"2351-\u81ea\u5b9a\u4e49\u5e8f\u5217\u5316\u63d0\u4f9b\u5668",children:"23.5.1 \u81ea\u5b9a\u4e49\u5e8f\u5217\u5316\u63d0\u4f9b\u5668"}),"\n",(0,r.jsxs)(n.p,{children:["\u6b63\u5982\u4e0a\u6587\u6240\u8bf4\uff0c",(0,r.jsx)(n.code,{children:"Furion"})," \u9ed8\u8ba4\u7684 ",(0,r.jsx)(n.code,{children:"IJsonSerializerProvider"})," \u5b9e\u73b0\u65b9\u5f0f\u662f ",(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u5e93\uff0c\u5982\u9700\u66ff\u6362\u4e3a ",(0,r.jsx)(n.code,{children:"Newtonsoft.Json"}),"\uff0c\u53ea\u9700\u4ee5\u4e0b\u6b65\u9aa4\u5373\u53ef\uff1a"]}),"\n",(0,r.jsx)(n.admonition,{title:"\u65e0\u9700\u5b89\u88c5",type:"tip",children:(0,r.jsxs)(n.p,{children:["\u5728 ",(0,r.jsx)(n.code,{children:"Furion 4.6.5+"})," \u7248\u672c\u5df2\u7ecf\u5185\u7f6e\u4e86 ",(0,r.jsx)(n.code,{children:"Microsoft.AspNetCore.Mvc.NewtonsoftJson"})," \u62d3\u5c55\u5305\uff0c\u4e5f\u5c31\u662f\u76f4\u63a5\u5728 ",(0,r.jsx)(n.code,{children:"Startup.cs"})," \u4e2d\u6ce8\u518c\u5373\u53ef\u3002"]})}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:["\u5b89\u88c5 ",(0,r.jsx)(n.code,{children:"Microsoft.AspNetCore.Mvc.NewtonsoftJson"})," \u62d3\u5c55\uff0c\u5e76\u5728 ",(0,r.jsx)(n.code,{children:"Startup.cs"})," \u4e2d\u6ce8\u518c"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2}",children:"services.AddControllersWithViews()\r\n .AddNewtonsoftJson();\n"})}),"\n",(0,r.jsxs)(n.ol,{start:"2",children:["\n",(0,r.jsxs)(n.li,{children:["\u5b9e\u73b0 ",(0,r.jsx)(n.code,{children:"IJsonSerializerProvider"})," \u63d0\u4f9b\u5668"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {9}",children:'using Furion.JsonSerialization;\r\nusing Newtonsoft.Json;\r\n\r\nnamespace Furion.Core;\r\n\r\n/// \r\n/// Newtonsoft.Json \u5b9e\u73b0\r\n/// \r\npublic class NewtonsoftJsonSerializerProvider : IJsonSerializerProvider, ISingleton\r\n{\r\n /// \r\n /// \u5e8f\u5217\u5316\u5bf9\u8c61\r\n /// \r\n /// \r\n /// \r\n /// \r\n public string Serialize(object value, object jsonSerializerOptions = null)\r\n {\r\n return JsonConvert.SerializeObject(value, (jsonSerializerOptions ?? GetSerializerOptions()) as JsonSerializerSettings);\r\n }\r\n\r\n /// \r\n /// \u53cd\u5e8f\u5217\u5316\u5b57\u7b26\u4e32\r\n /// \r\n /// \r\n /// \r\n /// \r\n /// \r\n public T Deserialize(string json, object jsonSerializerOptions = null)\r\n {\r\n return JsonConvert.DeserializeObject(json, (jsonSerializerOptions ?? GetSerializerOptions()) as JsonSerializerSettings);\r\n }\r\n\r\n /// \r\n /// \u53cd\u5e8f\u5217\u5316\u5b57\u7b26\u4e32\r\n /// \r\n /// \r\n /// \r\n /// \r\n /// \r\n public object Deserialize(string json, Type returnType, object jsonSerializerOptions = null)\r\n {\r\n return JsonConvert.DeserializeObject(json, returnType, (jsonSerializerOptions ?? GetSerializerOptions()) as JsonSerializerSettings);\r\n }\r\n\r\n /// \r\n /// \u8fd4\u56de\u8bfb\u53d6\u5168\u5c40\u914d\u7f6e\u7684 JSON \u9009\u9879\r\n /// \r\n /// \r\n public object GetSerializerOptions()\r\n {\r\n return App.GetOptions()?.SerializerSettings;\r\n }\r\n}\n'})}),"\n",(0,r.jsx)(n.h3,{id:"2352-\u5e8f\u5217\u5316\u5c5e\u6027\u540d\u5927\u5199\u5c5e\u6027\u539f\u6837\u8f93\u51fa",children:"23.5.2 \u5e8f\u5217\u5316\u5c5e\u6027\u540d\u5927\u5199\uff08\u5c5e\u6027\u539f\u6837\u8f93\u51fa\uff09"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"services.AddControllersWithViews()\r\n .AddJsonOptions(options => {\r\n options.JsonSerializerOptions.PropertyNamingPolicy = null;\r\n // options.JsonSerializerOptions.DictionaryKeyPolicy = null; // \u914d\u7f6e Dictionary \u7c7b\u578b\u5e8f\u5217\u5316\u8f93\u51fa\r\n });\n"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Newtonsoft.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"services.AddControllersWithViews()\r\n .AddNewtonsoftJson(options =>\r\n {\r\n options.SerializerSettings.ContractResolver = new DefaultContractResolver();\r\n });\n"})}),"\n",(0,r.jsxs)(n.admonition,{title:"\u7279\u522b\u6ce8\u610f",type:"important",children:[(0,r.jsxs)(n.p,{children:["\u91c7\u7528 ",(0,r.jsx)(n.code,{children:"Newtonsoft.Json"})," \u65b9\u5f0f\u63a5\u53e3\u8fd4\u56de\u503c\u80fd\u591f\u6b63\u5e38\u8f93\u51fa\uff0c\u4f46\u662f ",(0,r.jsx)(n.code,{children:"Swagger"})," \u754c\u9762\u4e2d\u7684 ",(0,r.jsx)(n.code,{children:"Example Values"})," \u4f9d\u7136\u663e\u793a\u5c0f\u5199\u5b57\u6bcd\u5f00\u5934\u7684\u5c5e\u6027\uff0c\u8fd9\u65f6\u53ea\u9700\u8981\u518d\u6dfb\u52a0 ",(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u914d\u7f6e\u5373\u53ef\uff0c\u5982\uff1a"]}),(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:".AddJsonOptions(options => {\r\n options.JsonSerializerOptions.PropertyNamingPolicy = null;\r\n });\n"})}),(0,r.jsxs)(n.p,{children:["\u4e3b\u8981\u539f\u56e0\u662f ",(0,r.jsx)(n.code,{children:"Swagger"})," \u62d3\u5c55\u5305\u5e95\u5c42\u4f9d\u8d56\u4e86 ",(0,r.jsx)(n.code,{children:"System.Text.Json"}),"\u3002"]})]}),"\n",(0,r.jsx)(n.h3,{id:"2353-\u65f6\u95f4\u683c\u5f0f\u5316\u65f6\u95f4\u6233\u8f6c\u65f6\u95f4",children:"23.5.3 \u65f6\u95f4\u683c\u5f0f\u5316\uff08\u65f6\u95f4\u6233\u8f6c\u65f6\u95f4\uff09"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["\u9700\u5f15\u7528 ",(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u547d\u540d\u7a7a\u95f4\u3002"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2,5}",children:'services.AddControllersWithViews()\r\n .AddJsonOptions(options =>\r\n {\r\n // \u5728 4.6.5 \u4e4b\u524d\u7684\u7248\u672c\u4f7f\u7528 .AddDateFormatString\r\n options.JsonSerializerOptions.Converters.AddDateTimeTypeConverters("yyyy-MM-dd HH:mm:ss");\r\n });\n'})}),"\n",(0,r.jsxs)(n.admonition,{title:"\u5c0f\u63d0\u793a",type:"note",children:[(0,r.jsxs)(n.p,{children:["\u5982\u679c\u4f7f\u7528\u4f7f\u7528\u4e86 ",(0,r.jsx)(n.code,{children:"DateTimeOffset"})," \u7c7b\u578b\uff0c\u90a3\u4e48\u53ef\u4ee5\u8bbe\u7f6e ",(0,r.jsx)(n.code,{children:'.AddDateTimeTypeConverters("yyyy-MM-dd HH:mm:ss", true)'})," \u7b2c\u4e8c\u4e2a\u53c2\u6570\u4e3a ",(0,r.jsx)(n.code,{children:"true"}),"\uff0c\u81ea\u52a8\u8f6c\u6362\u6210\u672c\u5730\u65f6\u95f4\u3002"]}),(0,r.jsxs)(n.p,{children:["\u5982\u679c\u4f7f\u7528\u4e86 ",(0,r.jsx)(n.code,{children:"Mysql"})," \u6570\u636e\u5e93\uff0c\u4e14\u4f7f\u7528\u4e86 ",(0,r.jsx)(n.code,{children:"Pomelo.EntityFrameworkCore.MySql"})," \u5305\uff0c\u90a3\u4e48\u4f1a\u51fa\u73b0\u65f6\u533a\u95ee\u9898\uff0c\u6bd4\u5982\u5c11 8 \u5c0f\u65f6\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u914d\u7f6e\u7b2c\u4e8c\u4e2a\u53c2\u6570\u4e3a ",(0,r.jsx)(n.code,{children:"true"}),"\u3002"]})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Newtonsoft.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["\u9700\u5f15\u7528 ",(0,r.jsx)(n.code,{children:"Newtonsoft.Json"})," \u547d\u540d\u7a7a\u95f4\u3002"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2,4,6-7}",children:'services.AddControllersWithViews()\r\n .AddNewtonsoftJson(options =>\r\n {\r\n options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss";\r\n\r\n // \u5728 Furion 4.9.1.3+ \u652f\u6301\r\n // options.SerializerSettings.Converters.AddDateTimeTypeConverters();\r\n });\n'})}),"\n",(0,r.jsxs)(n.admonition,{title:"\u65f6\u95f4\u6233\u8f6c\u65f6\u95f4\u7c7b\u578b",type:"tip",children:[(0,r.jsxs)(n.p,{children:["\u5728 ",(0,r.jsx)(n.code,{children:"Furion 4.9.1.3+"})," \u7248\u672c\u4e2d\uff0c\u8be5\u64cd\u4f5c\u8fd8\u652f\u6301\u81ea\u52a8\u5c06 ",(0,r.jsx)(n.code,{children:"13/10"})," \u4f4d\u65f6\u95f4\u6233\u6570\u503c\u6216\u5b57\u7b26\u4e32\u8f6c\u6362\u6210 ",(0,r.jsx)(n.code,{children:"DateTime/DateTime?/DateTimeOffset/DateTimeOffset?"})," \u7c7b\u578b\u3002"]}),(0,r.jsxs)(n.p,{children:["\u5982\u5c06 ",(0,r.jsx)(n.code,{children:"1699459200000"})," \u65f6\u95f4\u6233\u8f6c\u6362\u4e3a ",(0,r.jsx)(n.code,{children:"DateTime"})," \u7c7b\u578b\u3002"]}),(0,r.jsxs)(n.p,{children:["\u9488\u5bf9 ",(0,r.jsx)(n.code,{children:"GET/HEAD"})," \u8bf7\u6c42\u53ef\u901a\u8fc7\u8d34 ",(0,r.jsx)(n.code,{children:"[ModelBinder(BinderType = typeof(TimestampToDateTimeModelBinder))]"})," \u7279\u6027\u5904\u7406\u3002"]})]}),"\n",(0,r.jsx)(n.h3,{id:"2354-\u5ffd\u7565\u5faa\u73af\u5f15\u7528",children:"23.5.4 \u5ffd\u7565\u5faa\u73af\u5f15\u7528"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"services.AddControllersWithViews()\r\n .AddJsonOptions(options =>\r\n {\r\n options.JsonSerializerOptions.ReferenceHandler = ReferenceHandler.IgnoreCycles;\r\n });\n"})}),"\n",(0,r.jsx)(n.admonition,{title:"\u7279\u522b\u8bf4\u660e",type:"important",children:(0,r.jsxs)(n.p,{children:["\u5728 ",(0,r.jsx)(n.code,{children:".NET 5"})," \u4e2d\uff0c",(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u5e76\u4e0d\u652f\u6301\u5904\u7406\u5faa\u73af\u5f15\u7528\u95ee\u9898\uff0c\u4ee5\u4e0a\u7684\u89e3\u51b3\u65b9\u6848\u4ec5\u9650\u7528\u4e8e ",(0,r.jsx)(n.code,{children:".NET 6 Preview 2+"}),"\u3002\ud83d\ude02"]})}),"\n",(0,r.jsxs)(n.p,{children:["\u9700\u5f15\u7528 ",(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u547d\u540d\u7a7a\u95f4\u3002"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Newtonsoft.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"services.AddControllersWithViews()\r\n .AddNewtonsoftJson(options =>\r\n {\r\n options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;\r\n });\n"})}),"\n",(0,r.jsx)(n.h3,{id:"2355-\u5305\u542b\u6210\u5458\u5b57\u6bb5\u5e8f\u5217\u5316",children:"23.5.5 \u5305\u542b\u6210\u5458\u5b57\u6bb5\u5e8f\u5217\u5316"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"services.AddControllersWithViews()\r\n .AddJsonOptions(options =>\r\n {\r\n options.JsonSerializerOptions.IncludeFields = true;\r\n });\n"})}),"\n",(0,r.jsxs)(n.p,{children:["\u9700\u5f15\u7528 ",(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u547d\u540d\u7a7a\u95f4\u3002"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Newtonsoft.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"\u65e0\u9700\u914d\u7f6e\u3002"}),"\n",(0,r.jsx)(n.h3,{id:"2356-\u5141\u8bb8\u5c3e\u968f\u9017\u53f7",children:"23.5.6 \u5141\u8bb8\u5c3e\u968f\u9017\u53f7"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"services.AddControllersWithViews()\r\n .AddJsonOptions(options =>\r\n {\r\n options.JsonSerializerOptions.AllowTrailingCommas = true;\r\n });\n"})}),"\n",(0,r.jsxs)(n.p,{children:["\u9700\u5f15\u7528 ",(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u547d\u540d\u7a7a\u95f4\u3002"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Newtonsoft.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"\u65e0\u9700\u914d\u7f6e\u3002"}),"\n",(0,r.jsx)(n.h3,{id:"2357-\u5141\u8bb8\u6ce8\u91ca",children:"23.5.7 \u5141\u8bb8\u6ce8\u91ca"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"services.AddControllersWithViews()\r\n .AddJsonOptions(options =>\r\n {\r\n options.JsonSerializerOptions.ReadCommentHandling = JsonCommentHandling.Skip;\r\n });\n"})}),"\n",(0,r.jsxs)(n.p,{children:["\u9700\u5f15\u7528 ",(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u547d\u540d\u7a7a\u95f4\u3002"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Newtonsoft.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"\u65e0\u9700\u914d\u7f6e\u3002"}),"\n",(0,r.jsx)(n.h3,{id:"2358-\u5904\u7406\u4e2d\u6587\u4e71\u7801\u95ee\u9898",children:"23.5.8 \u5904\u7406\uff08\u4e2d\u6587\uff09\u4e71\u7801\u95ee\u9898"}),"\n",(0,r.jsx)(n.p,{children:"\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u82e5\u5e8f\u5217\u5316\u5bf9\u8c61\u5305\u542b\u4e2d\u6587\u6216\u7279\u6b8a\u5b57\u7b26\u4f1a\u88ab\u8f6c\u4e49\uff0c\u5982\uff1a"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",metastring:"showLineNumbers {5}",children:'{\r\n "statusCode": 500,\r\n "data": null,\r\n "succeeded": false,\r\n "errors": "\\u8BF7\\u6C42\\u53C2\\u6570ips\\u4E0D\\u5141\\u8BB8\\u4E3A\\u7A7A\\uFF01",\r\n "extras": null,\r\n "timestamp": 1698390015\r\n}\n'})}),"\n",(0,r.jsx)(n.p,{children:"\u8fd9\u65f6\u53ea\u9700\u8981\u901a\u8fc7\u4e0b\u9762\u914d\u7f6e\u5373\u53ef\uff1a"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"services.AddControllersWithViews()\r\n .AddJsonOptions(options =>\r\n {\r\n options.JsonSerializerOptions.Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping;\r\n });\n"})}),"\n",(0,r.jsxs)(n.p,{children:["\u9700\u5f15\u7528 ",(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u547d\u540d\u7a7a\u95f4\u3002"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Newtonsoft.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"\u65e0\u9700\u914d\u7f6e\u3002"}),"\n",(0,r.jsx)(n.h3,{id:"2359-\u4e0d\u533a\u5206\u5927\u5c0f\u5199",children:"23.5.9 \u4e0d\u533a\u5206\u5927\u5c0f\u5199"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"services.AddControllersWithViews()\r\n .AddJsonOptions(options =>\r\n {\r\n options.JsonSerializerOptions.PropertyNameCaseInsensitive = true;\r\n });\n"})}),"\n",(0,r.jsxs)(n.p,{children:["\u9700\u5f15\u7528 ",(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u547d\u540d\u7a7a\u95f4\u3002"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Newtonsoft.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.admonition,{title:"\u66f4\u591a\u5e8f\u5217\u5316\u914d\u7f6e",type:"tip",children:(0,r.jsxs)(n.p,{children:["\u8fd9\u91cc\u53ea\u5217\u4e3e\u5e38\u7528\u89c1\u7684\u5e8f\u5217\u5316\u914d\u7f6e\uff0c\u5982\u9700\u67e5\u770b\u66f4\u591a\u914d\u7f6e\uff0c\u53ef\u67e5\u9605 ",(0,r.jsx)(n.a,{href:"https://docs.microsoft.com/zh-cn/dotnet/standard/serialization/system-text-json-configure-options?pivots=dotnet-5-0",children:"System.Text.Json \u6587\u6863"})]})}),"\n",(0,r.jsx)(n.h3,{id:"23510-\u5ffd\u7565\u7279\u5b9a\u5c5e\u6027\u5e8f\u5217\u5316",children:"23.5.10 \u5ffd\u7565\u7279\u5b9a\u5c5e\u6027\u5e8f\u5217\u5316"}),"\n",(0,r.jsxs)(n.p,{children:["\u6709\u65f6\u5019\u6211\u4eec\u4e0d\u5e0c\u671b\u5bf9\u8c61\u4e2d\u67d0\u4e2a\u5bf9\u8c61\u88ab\u5e8f\u5217\u5316\u51fa\u6765\u6216\u8005\u4e0d\u60f3\u5728 ",(0,r.jsx)(n.code,{children:"Swagger"})," \u4e2d\u663e\u793a\uff0c\u8fd9\u65f6\u5019\u53ea\u9700\u8981\u5728\u5c5e\u6027\u8d34\u8be5\u7279\u6027\u5373\u53ef\uff1a"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"[Newtonsoft.Json.JsonIgnore] // \u9488\u5bf9 Newtonsoft\r\n[System.Text.Json.Serialization.JsonIgnore] // \u9488\u5bf9 System.Text.Json\r\npublic string PropertyName {get; set;}\n"})}),"\n",(0,r.jsx)(n.h3,{id:"23511-\u52a8\u6001\u5bf9\u8c61\u5c5e\u6027\u540d\u5927\u5199\u95ee\u9898",children:"23.5.11 \u52a8\u6001\u5bf9\u8c61\u5c5e\u6027\u540d\u5927\u5199\u95ee\u9898"}),"\n",(0,r.jsx)(n.p,{children:"\u6709\u65f6\u5019\u4f7f\u7528\u4e86\u52a8\u6001\u5bf9\u8c61\u540e\u53d1\u73b0\u5c5e\u6027\u540d\u51fa\u73b0\u4e86\u5927\u5199\u60c5\u51b5\uff08\u9996\u5b57\u6bcd\uff09\uff0c\u8fd9\u4e2a\u65f6\u5019\u53ef\u4ee5\u5c1d\u8bd5\u4f7f\u7528\u4ee5\u4e0b\u65b9\u6cd5\u89e3\u51b3\uff1a"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:".AddNewtonsoftJson(options =>\r\n{\r\n options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();\r\n})\n"})}),"\n",(0,r.jsxs)(n.h3,{id:"23512-\u5ffd\u7565\u6240\u6709-null-\u5c5e\u6027",children:["23.5.12 \u5ffd\u7565\u6240\u6709 ",(0,r.jsx)(n.code,{children:"null"})," \u5c5e\u6027"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {4}",children:"services.AddControllersWithViews()\r\n .AddJsonOptions(options =>\r\n {\r\n options.JsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull;\r\n });\n"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Newtonsoft.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {3}",children:".AddNewtonsoftJson(options =>\r\n{\r\n options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore;\r\n})\n"})}),"\n",(0,r.jsx)(n.h3,{id:"23513-\u5ffd\u7565\u6240\u6709\u9ed8\u8ba4\u503c\u5c5e\u6027",children:"23.5.13 \u5ffd\u7565\u6240\u6709\u9ed8\u8ba4\u503c\u5c5e\u6027"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {4}",children:"services.AddControllersWithViews()\r\n .AddJsonOptions(options =>\r\n {\r\n options.JsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault;\r\n });\n"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Newtonsoft.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {3}",children:".AddNewtonsoftJson(options =>\r\n{\r\n options.SerializerSettings.DefaultValueHandling = DefaultValueHandling.Ignore;\r\n})\n"})}),"\n",(0,r.jsx)(n.h3,{id:"23514-\u63a7\u5236\u5c5e\u6027\u5e8f\u5217\u5316\u987a\u5e8f",children:"23.5.14 \u63a7\u5236\u5c5e\u6027\u5e8f\u5217\u5316\u987a\u5e8f"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"[Newtonsoft.Json.JsonProperty(Order = 0)] // \u9488\u5bf9 Newtonsoft\r\n[System.Text.Json.Serialization.JsonPropertyOrder(0)] // \u9488\u5bf9 System.Text.Json\r\npublic string PropertyName {get; set;}\n"})}),"\n",(0,r.jsx)(n.h3,{id:"23515-\u91cd\u547d\u540d\u5e8f\u5217\u5316\u540d\u79f0\u5c5e\u6027\u540d\u79f0",children:"23.5.15 \u91cd\u547d\u540d\u5e8f\u5217\u5316\u540d\u79f0\uff08\u5c5e\u6027\u540d\u79f0\uff09"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:'[Newtonsoft.Json.JsonProperty("newName")] // \u9488\u5bf9 Newtonsoft\r\n[System.Text.Json.Serialization.JsonPropertyName("newName")] // \u9488\u5bf9 System.Text.Json\r\npublic string PropertyName {get; set;}\n'})}),"\n",(0,r.jsxs)(n.h3,{id:"23516-json-\u5b57\u7b26\u4e32\u7f29\u8fdb",children:["23.5.16 ",(0,r.jsx)(n.code,{children:"JSON"})," \u5b57\u7b26\u4e32\u7f29\u8fdb"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {4}",children:"services.AddControllersWithViews()\r\n .AddJsonOptions(options =>\r\n {\r\n options.JsonSerializerOptions.WriteIndented = true;\r\n });\n"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Newtonsoft.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {3}",children:".AddNewtonsoftJson(options =>\r\n{\r\n options.SerializerSettings.Formatting = Newtonsoft.Json.Formatting.Indented;\r\n})\n"})}),"\n",(0,r.jsxs)(n.h3,{id:"23517-long-\u7c7b\u578b\u5e8f\u5217\u5316\u65f6\u8f6c-string",children:["23.5.17 ",(0,r.jsx)(n.code,{children:"long"})," \u7c7b\u578b\u5e8f\u5217\u5316\u65f6\u8f6c ",(0,r.jsx)(n.code,{children:"string"})]}),"\n",(0,r.jsxs)(n.p,{children:["\u6709\u65f6\u5019\u6211\u4eec\u9700\u8981\u5c06 ",(0,r.jsx)(n.code,{children:" long"})," \u7c7b\u578b\u5e8f\u5217\u5316\u65f6\u8f6c\u4e3a ",(0,r.jsx)(n.code,{children:"string"})," \u7c7b\u578b\uff0c\u9632\u6b62 ",(0,r.jsx)(n.code,{children:"JavaScript"})," \u51fa\u73b0\u7cbe\u5ea6\u6ea2\u51fa\u95ee\u9898\uff0c\u8fd9\u4e2a\u65f6\u5019\u53ef\u4ee5\u5c1d\u8bd5\u4f7f\u7528\u4ee5\u4e0b\u65b9\u6cd5\u89e3\u51b3\uff1a"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2,4}",children:"services.AddControllersWithViews()\r\n .AddJsonOptions(options =>\r\n {\r\n options.JsonSerializerOptions.Converters.AddLongTypeConverters();\r\n });\n"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Newtonsoft.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {3}",children:".AddNewtonsoftJson(options =>\r\n{\r\n options.SerializerSettings.Converters.AddLongTypeConverters();\r\n})\n"})}),"\n",(0,r.jsxs)(n.admonition,{type:"note",children:[(0,r.jsxs)(n.mdxAdmonitionTitle,{children:["\u5173\u4e8e ",(0,r.jsx)(n.code,{children:"Dictionary<,>"})," \u7c7b\u578b\u5305\u542b ",(0,r.jsx)(n.code,{children:"long"})," \u5904\u7406"]}),(0,r.jsxs)(n.p,{children:["\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c",(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u4e0d\u652f\u6301 ",(0,r.jsx)(n.code,{children:"Dictionary<,>"})," \u7c7b\u578b\u7684\u5e8f\u5217\u5316\u8bbe\u7f6e ",(0,r.jsx)(n.code,{children:"Converter"})," \u64cd\u4f5c\uff0c\u8fd9\u4e2a\u65f6\u5019\u53ef\u4ee5\u6362\u6210 ",(0,r.jsx)(n.code,{children:"Newtonsoft.Json"})," \u5904\u7406\uff0c\u5982\uff1a"]}),(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {3}",children:".AddNewtonsoftJson(options =>\r\n{\r\n options.SerializerSettings.Converters.AddLongTypeConverters();\r\n})\n"})}),(0,r.jsxs)(n.p,{children:["\u540c\u65f6\u521b\u5efa ",(0,r.jsx)(n.code,{children:"NewtonsoftJsonSerializerProvider.cs"})," \u6587\u4ef6\u5199\u5165\u5373\u53ef\uff1a"]}),(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"namespace YourProject.Core;\r\n\r\npublic class NewtonsoftJsonSerializerProvider : IJsonSerializerProvider, ISingleton\r\n{\r\n public string Serialize(object value, object jsonSerializerOptions = null)\r\n {\r\n return JsonConvert.SerializeObject(value, (jsonSerializerOptions ?? GetSerializerOptions()) as JsonSerializerSettings);\r\n }\r\n\r\n public T Deserialize(string json, object jsonSerializerOptions = null)\r\n {\r\n return JsonConvert.DeserializeObject(json, (jsonSerializerOptions ?? GetSerializerOptions()) as JsonSerializerSettings);\r\n }\r\n\r\n public object GetSerializerOptions()\r\n {\r\n return App.GetOptions()?.SerializerSettings;\r\n }\r\n\r\n public object Deserialize(string json, Type returnType, object jsonSerializerOptions = null)\r\n {\r\n return JsonConvert.DeserializeObject(json, returnType, (jsonSerializerOptions ?? GetSerializerOptions()) as JsonSerializerSettings);\r\n }\r\n}\n"})})]}),"\n",(0,r.jsxs)(n.h3,{id:"23518-dateonly-\u548c-timeonly-\u7c7b\u578b\u5e8f\u5217\u5316\u652f\u6301",children:["23.5.18 ",(0,r.jsx)(n.code,{children:"DateOnly"})," \u548c ",(0,r.jsx)(n.code,{children:"TimeOnly"})," \u7c7b\u578b\u5e8f\u5217\u5316\u652f\u6301"]}),"\n",(0,r.jsxs)(n.p,{children:["\u5728 ",(0,r.jsx)(n.code,{children:".NET6+"})," \u6dfb\u52a0\u4e86 ",(0,r.jsx)(n.code,{children:"DateOnly"})," \u548c ",(0,r.jsx)(n.code,{children:"TimeOnly"})," \u7c7b\u578b\uff0c",(0,r.jsx)(n.code,{children:"Furion 4.7.9+"})," \u63d0\u4f9b\u4e86\u652f\u6301\u3002"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2,4-5}",children:"services.AddControllersWithViews()\r\n .AddJsonOptions(options =>\r\n {\r\n options.JsonSerializerOptions.Converters.AddDateOnlyConverters(); // DateOnly\r\n options.JsonSerializerOptions.Converters.AddTimeOnlyConverters(); // TimeOnly\r\n });\n"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Newtonsoft.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {3-4}",children:".AddNewtonsoftJson(options =>\r\n{\r\n options.SerializerSettings.Converters.AddDateOnlyConverters(); // DateOnly\r\n options.SerializerSettings.Converters.AddTimeOnlyConverters(); // TimeOnly\r\n})\n"})}),"\n",(0,r.jsxs)(n.h3,{id:"23519-\u7c98\u571f\u5bf9\u8c61-clay-\u7c7b\u578b\u5e8f\u5217\u5316\u652f\u6301",children:["23.5.19 \u7c98\u571f\u5bf9\u8c61 ",(0,r.jsx)(n.code,{children:"Clay"})," \u7c7b\u578b\u5e8f\u5217\u5316\u652f\u6301"]}),"\n",(0,r.jsxs)(n.p,{children:["\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c",(0,r.jsx)(n.code,{children:"Clay"})," \u4e3a\u52a8\u6001\u7c7b\u578b\u5bf9\u8c61\uff0c\u4e0d\u652f\u6301\u76f4\u63a5\u901a\u8fc7 ",(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u548c ",(0,r.jsx)(n.code,{children:"Newtonsoft.Json"})," \u8fdb\u884c\u5e8f\u5217\u5316\u548c\u53cd\u5e8f\u5217\u5316\uff0c\u8fd9\u65f6\u53ea\u9700\u6dfb\u52a0\u4ee5\u4e0b\u914d\u7f6e\u5373\u53ef\u3002"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2,4}",children:"services.AddControllersWithViews()\r\n .AddJsonOptions(options =>\r\n {\r\n options.JsonSerializerOptions.Converters.AddClayConverters();\r\n });\n"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Newtonsoft.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {3}",children:".AddNewtonsoftJson(options =>\r\n{\r\n options.SerializerSettings.Converters.AddClayConverters();\r\n})\n"})}),"\n",(0,r.jsxs)(n.h3,{id:"23520-datetimeoffset-\u53cd\u5e8f\u5217\u5316\u5f02\u5e38",children:["23.5.20 ",(0,r.jsx)(n.code,{children:"DateTimeOffset"})," \u53cd\u5e8f\u5217\u5316\u5f02\u5e38"]}),"\n",(0,r.jsxs)(n.p,{children:["\u4ee5\u4e0b\u5904\u7406\u53ea\u9488\u5bf9 ",(0,r.jsx)(n.code,{children:"Newtonsoft.Json"}),"\uff0c\u6570\u636e\u4e3a ",(0,r.jsx)(n.code,{children:"0001-01-01 00:00:00"})," \u7684\u60c5\u5f62\u4e0b\u53cd\u5e8f\u5217\u5316\u4e3a ",(0,r.jsx)(n.code,{children:"DateTimeOffset"})," \u7c7b\u578b\u62a5\u9519\uff1a"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-txt",metastring:"showLineNumbers",children:"Could not convert string to DateTimeOffset: 0001-01-01 00:00:00\n"})}),"\n",(0,r.jsxs)(n.p,{children:["\u76f8\u5173\u95ee\u9898\u8ba8\u8bba\uff1a",(0,r.jsx)(n.a,{href:"https://stackoverflow.com/questions/50628374/json-net-deserializing-datetimeoffset-value-fails-for-datetimeoffset-minvalue-wi/50631270#50631270",children:"https://stackoverflow.com/questions/50628374/json-net-deserializing-datetimeoffset-value-fails-for-datetimeoffset-minvalue-wi/50631270#50631270"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"\u65e0\u9700\u914d\u7f6e"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Newtonsoft.Json"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {3-5}",children:".AddNewtonsoftJson(options =>\r\n{\r\n options.SerializerSettings.MetadataPropertyHandling = MetadataPropertyHandling.Ignore;\r\n options.SerializerSettings.DateParseHandling = DateParseHandling.None;\r\n options.SerializerSettings.Converters.Add(new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal });\r\n});\n"})}),"\n",(0,r.jsx)(n.h3,{id:"23521-\u7ee7\u627f\u6d3e\u751f\u7c7b\u5e8f\u5217\u5316\u95ee\u9898",children:"23.5.21 \u7ee7\u627f/\u6d3e\u751f\u7c7b\u5e8f\u5217\u5316\u95ee\u9898"}),"\n",(0,r.jsxs)(n.p,{children:["\u5728 ",(0,r.jsx)(n.code,{children:".NET7"})," \u4e4b\u524d\uff0c",(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u9ed8\u8ba4\u4e0d\u652f\u6301\u5e8f\u5217\u5316\u57fa\u7c7b\u5c5e\u6027\uff0c\u4f46\u4e5f\u63d0\u4f9b\u4e86\u89e3\u51b3\u65b9\u6cd5\uff1a"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,4}",children:"// \u7b2c\u4e00\u79cd\uff0c\u4f7f\u7528 \u6cdb\u578b\r\nvar json = JsonSerializer.Serialize(value);\r\n\r\n// \u7b2c\u4e8c\u79cd\uff0c\u4f7f\u7528 Type \u53c2\u6570\r\nvar json = JsonSerializer.Serialize(value, value.GetType());\n"})}),"\n",(0,r.jsxs)(n.p,{children:["\u67e5\u770b\u8be6\u7ec6\u6587\u6863\uff1a",(0,r.jsx)(n.a,{href:"https://learn.microsoft.com/zh-cn/dotnet/standard/serialization/system-text-json/polymorphism?pivots=dotnet-6-0",children:"https://learn.microsoft.com/zh-cn/dotnet/standard/serialization/system-text-json/polymorphism?pivots=dotnet-6-0"})]}),"\n",(0,r.jsx)(n.h3,{id:"23522-\u679a\u4e3e\u548c\u5b57\u7b26\u4e32\u4e92\u8f6c\u95ee\u9898",children:"23.5.22 \u679a\u4e3e\u548c\u5b57\u7b26\u4e32\u4e92\u8f6c\u95ee\u9898"}),"\n",(0,r.jsx)(n.p,{children:"\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u80fd\u5c06\u679a\u4e3e\u8f6c\u6362\u4e3a\u6570\u5b57\u6216\u5c06\u6570\u5b57\u8f6c\u6362\u4e3a\u679a\u4e3e\u5bf9\u8c61\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5c40\u90e8\u6216\u5168\u5c40\u914d\u7f6e\u5b9e\u73b0\u5b57\u7b26\u4e32\u4e92\u8f6c\uff0c\u5982\uff1a"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"\u5c40\u90e8"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1}",children:"[JsonConverter(typeof(JsonStringEnumConverter))]\r\npublic Gender Gender { get; set; }\n"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"\u5168\u5c40"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2-4}",children:"services.AddControllersWithViews()\r\n .AddJsonOptions(options =>\r\n {\r\n options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());\r\n });\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"236-datatabledatasettuple-jarrayjobjectjtoken-\u7b49\u5e8f\u5217\u5316\u95ee\u9898",children:["23.6 ",(0,r.jsx)(n.code,{children:"DataTable"}),"\u3001",(0,r.jsx)(n.code,{children:"DataSet"}),"\u3001",(0,r.jsx)(n.code,{children:"Tuple"})," \u3001",(0,r.jsx)(n.code,{children:"JArray"}),"\uff0c",(0,r.jsx)(n.code,{children:"JObject"}),"\uff0c",(0,r.jsx)(n.code,{children:"JToken"})," \u7b49\u5e8f\u5217\u5316\u95ee\u9898"]}),"\n",(0,r.jsxs)(n.p,{children:["\u7531\u4e8e ",(0,r.jsx)(n.code,{children:"Furion"})," \u9ed8\u8ba4\u91c7\u7528 ",(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u8fdb\u884c\u5e8f\u5217\u5316\uff0c\u4f46\u662f\u4e0d\u652f\u6301\u590d\u6742\u7c7b\u578b\uff0c\u5982 ",(0,r.jsx)(n.code,{children:"DataTable"}),"\u3001",(0,r.jsx)(n.code,{children:"DataSet"}),"\u3001",(0,r.jsx)(n.code,{children:"Tuple"})," \u3001",(0,r.jsx)(n.code,{children:"JArray"}),"\uff0c",(0,r.jsx)(n.code,{children:"JObject"}),"\u3001",(0,r.jsx)(n.code,{children:"JToken"})," \u7b49\u7c7b\u578b\uff0c\u6240\u4ee5\u9700\u8981\u66f4\u6362\u6210 ",(0,r.jsx)(n.code,{children:"NewtonsoftJson"})," \u5373\u53ef\uff0c\u89c1 ",(0,r.jsx)(n.a,{href:"./json-serialization#2351-%E8%87%AA%E5%AE%9A%E4%B9%89%E5%BA%8F%E5%88%97%E5%8C%96%E6%8F%90%E4%BE%9B%E5%99%A8",children:"JSON \u5e8f\u5217\u5316 - 23.5.1 \u81ea\u5b9a\u4e49\u5e8f\u5217\u5316\u63d0\u4f9b\u5668"})]}),"\n",(0,r.jsxs)(n.h2,{id:"237-systemtextjson-\u548c-newtonsoftjson-\u5b8c\u6574\u5dee\u5f02\u5316\u5bf9\u6bd4",children:["23.7 ",(0,r.jsx)(n.code,{children:"System.Text.Json"})," \u548c ",(0,r.jsx)(n.code,{children:"Newtonsoft.Json"})," \u5b8c\u6574\u5dee\u5f02\u5316\u5bf9\u6bd4"]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://docs.microsoft.com/zh-cn/dotnet/standard/serialization/system-text-json-migrate-from-newtonsoft-how-to?pivots=dotnet-5-0",children:"https://docs.microsoft.com/zh-cn/dotnet/standard/serialization/system-text-json-migrate-from-newtonsoft-how-to?pivots=dotnet-5-0"})}),"\n",(0,r.jsx)(n.h2,{id:"238-\u53cd\u9988\u4e0e\u5efa\u8bae",children:"23.8 \u53cd\u9988\u4e0e\u5efa\u8bae"}),"\n",(0,r.jsx)(n.admonition,{title:"\u4e0e\u6211\u4eec\u4ea4\u6d41",type:"note",children:(0,r.jsxs)(n.p,{children:["\u7ed9 Furion \u63d0 ",(0,r.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/new?issue",children:"Issue"}),"\u3002"]})})]})}function j(e={}){const{wrapper:n}={...(0,i.a)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(h,{...e})}):h(e)}},510:(e,n,s)=>{s.d(n,{Z:()=>G});s(7294);const r=(e,n,s)=>e?"string"==typeof e?e:e[n]||s:s;var i=s(5893);const o={display:"block"},l=e=>{let{size:n,color:s,style:l,...t}=e;const c=l?{...o,...l}:o;return(0,i.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:c,...t,children:(0,i.jsx)("path",{d:"M856.4 292.8c-63.3-63.6-126.6-127.1-190.2-190.3-15.3-15.2-32.7-16.1-48.1-0.8-64.3 63.6-128.1 127.6-191.8 191.9-14 14.2-16.3 31.6-1.7 46 14.8 14.7 31.5 10.6 46.1-2.7 5.1-4.6 9.8-9.7 14.7-14.7 39.2-39.7 78.5-79.5 122.8-124.4 0 170 3 332.2-1.1 494-2.4 96.4-91.2 174.6-187.4 176.6-110.6 2.3-198.6-84.4-199-197.4-0.6-136.3-0.2-272.6-0.1-408.9 0-21.8-7.9-37.4-31.2-39.9-18.9-2-33.2 13.2-33.1 37.5 0 145.8-3.4 291.7 2.4 437.2 6 152.1 160.4 263.5 309.5 230.5C591.8 900 672.8 797.2 673.6 664.6c0.8-144 0.2-288.1 0.2-432.1v-33.3c11.2 10.2 17.6 15.4 23.3 21.3 38.5 38.4 76.7 77 115.3 115.2 14.8 14.6 32.2 19.2 47.8 2.9 13.8-14.8 10.3-31.7-3.8-45.8z",fill:r(s,0,"#333333")})})};l.defaultProps={size:18};const t=l,c={display:"block"},d=e=>{let{size:n,color:s,style:o,...l}=e;const t=o?{...c,...o}:c;return(0,i.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...l,children:[(0,i.jsx)("path",{d:"M143.872 768a51.2 51.2 0 0 1-15.36-2.56 51.2 51.2 0 0 1-35.328-51.2V283.136a148.992 148.992 0 0 1 141.824-153.6h450.56a148.992 148.992 0 0 1 141.824 153.6V512a148.992 148.992 0 0 1-141.824 153.6H244.224l-60.928 80.896a51.2 51.2 0 0 1-39.424 21.504zM235.008 180.224a97.792 97.792 0 0 0-90.624 102.4v430.592L218.624 614.4h466.944a97.792 97.792 0 0 0 90.624-102.4V283.136a97.792 97.792 0 0 0-90.624-102.4z",fill:r(s,0,"#333333")}),(0,i.jsx)("path",{d:"M880.128 875.52a51.2 51.2 0 0 1-39.424-20.48l-60.928-80.896h-243.2a25.6 25.6 0 0 1 0-51.2h268.8l76.288 102.4v-295.936a25.6 25.6 0 0 1 25.6-25.6 25.6 25.6 0 0 1 25.6 25.6v293.888a51.2 51.2 0 0 1-51.2 51.2z",fill:r(s,1,"#333333")})]})};d.defaultProps={size:18};const a=d,h={display:"block"},j=e=>{let{size:n,color:s,style:o,...l}=e;const t=o?{...h,...o}:h;return(0,i.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...l,children:[(0,i.jsx)("path",{d:"M223.425605 449.2744l161.632237 0 0 253.65714c0 16.954137 13.745049 30.699186 30.699186 30.699186 16.95516 0 30.699186-13.745049 30.699186-30.699186l0-284.356326c0-16.95516-13.744026-30.699186-30.699186-30.699186L291.035446 387.876028l217.23665-248.51605L733.039255 387.580293 607.104031 387.580293c-16.954137 0-30.699186 13.745049-30.699186 30.699186l0 284.652062c0 16.954137 13.745049 30.699186 30.699186 30.699186s30.699186-13.745049 30.699186-30.699186L637.803217 448.978664l164.448376 0c12.140505 0 23.140023-7.154957 28.063149-18.251689 4.922103-11.097756 2.841721-24.053835-5.307889-33.05279L530.62315 72.570829c-5.881964-6.495948-14.273075-10.134825-23.024389-10.091846-8.763594 0.076748-17.076934 3.895727-22.844288 10.494005L200.312188 398.371056c-7.92653 9.067516-9.818623 21.931498-4.839215 32.896224S211.383338 449.2744 223.425605 449.2744z",fill:r(s,0,"#333333")}),(0,i.jsx)("path",{d:"M222.354204 829.113381l581.732178 0c16.954137 0 30.699186-13.745049 30.699186-30.699186s-13.745049-30.699186-30.699186-30.699186L222.354204 767.715009c-16.954137 0-30.699186 13.745049-30.699186 30.699186S205.400067 829.113381 222.354204 829.113381z",fill:r(s,1,"#333333")}),(0,i.jsx)("path",{d:"M804.086381 896.729361 222.354204 896.729361c-16.954137 0-30.699186 13.745049-30.699186 30.699186s13.745049 30.699186 30.699186 30.699186l581.732178 0c16.954137 0 30.699186-13.745049 30.699186-30.699186S821.041542 896.729361 804.086381 896.729361z",fill:r(s,2,"#333333")})]})};j.defaultProps={size:18};const x=j,p={display:"block"},m=e=>{let{size:n,color:s,style:o,...l}=e;const t=o?{...p,...o}:p;return(0,i.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...l,children:(0,i.jsx)("path",{d:"M380.15463648 874.54223633c0 18.12744166-14.83154297 32.95898463-32.95898463 32.95898463s-32.95898463-14.83154297-32.95898462-32.95898463V228.9152832L172.71078883 370.86962865a33.04467773 33.04467773 0 0 1-46.60400416 0 33.04467773 33.04467773 0 0 1 0-46.6040034l197.55615234-198.14941406A32.76782227 32.76782227 0 0 1 347.0967749 116.52514674c0.03295924 0 0.06591772-0.03295924 0.09887695-0.03295924 1.54907201 0 2.90039088 0.69213867 4.41650366 0.88989258 2.66967773 0.39550781 5.40527318 0.59326172 7.94311548 1.61499049 12.03002904 4.94384766 20.59936549 16.71020508 20.59936549 30.45410156v725.0910642z m320.15698192 23.34155248a32.85351537 32.85351537 0 0 1-23.43383789 9.59106445c-0.03295924 0-0.06591772 0.03295924-0.09887696 0.03295924-1.54907201 0-2.90039088-0.69213867-4.41650365-0.92285182-2.70263697-0.36254857-5.40527318-0.56030248-7.94311549-1.61498972-12.03002904-4.91088842-20.59936549-16.67724584-20.59936473-30.42114309V149.45776367c0-18.12744166 14.83154297-32.95898463 32.95898387-32.95898463s32.95898463 14.83154297 32.95898463 32.95898463v645.60058619l141.52587916-141.92138697c12.81445313-12.82104467 33.81591797-12.82104467 46.63037109 0 12.78808619 12.81445313 12.78808619 33.77636719 0 46.60400416L700.3116184 897.88378881z",fill:r(s,0,"#333333")})})};m.defaultProps={size:18};const u=m,g={display:"block"},v=e=>{let{size:n,color:s,style:o,...l}=e;const t=o?{...g,...o}:g;return(0,i.jsx)("svg",{viewBox:"0 0 1172 1024",width:n+"px",height:n+"px",style:t,...l,children:(0,i.jsx)("path",{d:"M870.0416 250.4704a38.4 38.4 0 0 0-8.96 53.5552c13.056 18.2784 24.4224 37.8368 33.7408 58.112a38.4512 38.4512 0 0 0 50.944 18.8928 38.4512 38.4512 0 0 0 18.8416-50.944 436.0192 436.0192 0 0 0-40.96-70.6048 38.3488 38.3488 0 0 0-53.6064-9.0112zM181.4528 566.016a35.9936 35.9936 0 0 0 25.5488-10.5984L351.7952 410.624a36.096 36.096 0 1 0-51.0976-51.0976L217.6 442.5728C250.0096 278.1184 395.264 153.6 569.1392 153.6c50.7904 0 99.8912 10.3936 145.92 30.9248a38.4 38.4 0 1 0 31.232-70.0928 431.36 431.36 0 0 0-177.152-37.632c-214.6816 0-393.1136 156.416-428.4416 361.216L62.1568 359.4752a36.1984 36.1984 0 0 0-51.0976 51.0976l144.8448 144.7936a36.0448 36.0448 0 0 0 25.5488 10.6496zM978.5344 463.104a36.1984 36.1984 0 0 0-51.0976 0l-144.8448 144.7936a36.096 36.096 0 1 0 51.0976 51.0976l88.6272-88.576C894.3104 740.2496 746.8032 870.4 569.1392 870.4a357.7856 357.7856 0 0 1-325.2736-207.7184 38.4 38.4 0 1 0-69.7344 32.3072 434.3808 434.3808 0 0 0 394.9568 252.2112c215.1936 0 393.984-157.184 428.6464-362.7008l74.496 74.496a35.9936 35.9936 0 0 0 51.0976 0 36.096 36.096 0 0 0 0-51.0976l-144.7936-144.7936z",fill:r(s,0,"#333333")})})};v.defaultProps={size:18};const S=v,y={display:"block"},z=e=>{let{size:n,color:s,style:o,...l}=e;const t=o?{...y,...o}:y;return(0,i.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...l,children:[(0,i.jsx)("path",{d:"M302 332a30 30 0 1 1 0-60h420a30 30 0 0 1 0 60H302zM302 542a30 30 0 0 1 0-60h420a30 30 0 0 1 0 60H302zM302 752a30 30 0 0 1 0-60h120a30 30 0 0 1 0 60H302z",fill:r(s,0,"#333333")}),(0,i.jsx)("path",{d:"M789.47 784.1a30 30 0 0 1 39.36 45.3l-144.24 125.25a30 30 0 0 1-19.68 7.35H214.85C163.4 962 122 919.46 122 867.38V156.62C122 104.54 163.4 62 214.85 62h594.3C860.6 62 902 104.54 902 156.62v529.05a30 30 0 1 1-60 0V156.62C842 137.3 827.09 122 809.15 122H214.85C196.91 122 182 137.3 182 156.62v710.76C182 886.7 196.91 902 214.85 902h438.84l135.78-117.9z",fill:r(s,1,"#333333")}),(0,i.jsx)("path",{d:"M692 931.19a30 30 0 1 1-60 0v-174.6C632 704.57 673.4 662 724.85 662h147.78a30 30 0 0 1 0 60h-147.78c-17.94 0-32.85 15.3-32.85 34.62v174.6z",fill:r(s,2,"#333333")})]})};z.defaultProps={size:18};const J=z,f={display:"block"},N=e=>{let{size:n,color:s,style:o,...l}=e;const t=o?{...f,...o}:f;return(0,i.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...l,children:[(0,i.jsx)("path",{d:"M512 883.2A371.2 371.2 0 1 0 140.8 512 371.2 371.2 0 0 0 512 883.2z m0 64a435.2 435.2 0 1 1 435.2-435.2 435.2 435.2 0 0 1-435.2 435.2z",fill:r(s,0,"#333333")}),(0,i.jsx)("path",{d:"M557.056 512l122.368 122.368a31.744 31.744 0 1 1-45.056 45.056L512 557.056l-122.368 122.368a31.744 31.744 0 1 1-45.056-45.056L466.944 512 344.576 389.632a31.744 31.744 0 1 1 45.056-45.056L512 466.944l122.368-122.368a31.744 31.744 0 1 1 45.056 45.056z",fill:r(s,1,"#333333")})]})};N.defaultProps={size:18};const w=N,b={display:"block"},O=e=>{let{size:n,color:s,style:o,...l}=e;const t=o?{...b,...o}:b;return(0,i.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...l,children:[(0,i.jsx)("path",{d:"M940 512H792V412c76.8 0 139-62.2 139-139 0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 34.8-28.2 63-63 63H232c-34.8 0-63-28.2-63-63 0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 76.8 62.2 139 139 139v100H84c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h148v96c0 6.5 0.2 13 0.7 19.3C164.1 728.6 116 796.7 116 876c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8 0-44.2 23.9-82.9 59.6-103.7 6 17.2 13.6 33.6 22.7 49 24.3 41.5 59 76.2 100.5 100.5S460.5 960 512 960s99.8-13.9 141.3-38.2c41.5-24.3 76.2-59 100.5-100.5 9.1-15.5 16.7-31.9 22.7-49C812.1 793.1 836 831.8 836 876c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8 0-79.3-48.1-147.4-116.7-176.7 0.4-6.4 0.7-12.8 0.7-19.3v-96h148c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM716 680c0 36.8-9.7 72-27.8 102.9-17.7 30.3-43 55.6-73.3 73.3-20.1 11.8-42 20-64.9 24.3V484c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v396.5c-22.9-4.3-44.8-12.5-64.9-24.3-30.3-17.7-55.6-43-73.3-73.3C317.7 752 308 716.8 308 680V412h408v268z",fill:r(s,0,"#333333")}),(0,i.jsx)("path",{d:"M304 280h56c4.4 0 8-3.6 8-8 0-28.3 5.9-53.2 17.1-73.5 10.6-19.4 26-34.8 45.4-45.4C450.9 142 475.7 136 504 136h16c28.3 0 53.2 5.9 73.5 17.1 19.4 10.6 34.8 26 45.4 45.4C650 218.9 656 243.7 656 272c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8 0-40-8.8-76.7-25.9-108.1-17.2-31.5-42.5-56.8-74-74C596.7 72.8 560 64 520 64h-16c-40 0-76.7 8.8-108.1 25.9-31.5 17.2-56.8 42.5-74 74C304.8 195.3 296 232 296 272c0 4.4 3.6 8 8 8z",fill:r(s,1,"#333333")})]})};O.defaultProps={size:18};const T=O,C={display:"block"},A=e=>{let{size:n,color:s,style:o,...l}=e;const t=o?{...C,...o}:C;return(0,i.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...l,children:[(0,i.jsx)("path",{d:"M512 71.68c-242.688 0-440.32 197.632-440.32 440.32s197.632 440.32 440.32 440.32 440.32-197.632 440.32-440.32-197.632-440.32-440.32-440.32z m0 819.2c-208.896 0-378.88-169.984-378.88-378.88s169.984-378.88 378.88-378.88 378.88 169.984 378.88 378.88-169.984 378.88-378.88 378.88z",fill:r(s,0,"#333333")}),(0,i.jsx)("path",{d:"M542.72 261.12H481.28v220.16H261.12v61.44h220.16v220.16h61.44v-220.16h220.16V481.28h-220.16z",fill:r(s,1,"#333333")})]})};A.defaultProps={size:18};const D=A,L={display:"block"},P=e=>{let{size:n,color:s,style:o,...l}=e;const t=o?{...L,...o}:L;return(0,i.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...l,children:(0,i.jsx)("path",{d:"M384 896h-64v-70.4c0-15.2-10.4-28-24.8-31.2C159.2 768 64 644.8 64 496v-32h64v32c0 118.4 73.6 215.2 179.2 236 44.8 8.8 76.8 48 76.8 94.4v69.6zM704 896h-64v-70.4c0-45.6 32-85.6 76.8-94.4C822.4 711.2 896 614.4 896 496v-32h64v32c0 148.8-95.2 272-231.2 298.4-14.4 3.2-24.8 16-24.8 31.2v70.4zM512.8 640l-41.6-37.6c-147.2-133.6-244-208-244-316.8 0-88 68.8-156.8 156.8-156.8 49.6 0 97.6 23.2 128.8 60C544 152 592 128.8 641.6 128.8c88 0 156.8 68.8 156.8 156.8 0 108-96.8 183.2-244 316.8L512.8 640z",fill:r(s,0,"#333333")})})};P.defaultProps={size:18};const M=P,I={display:"block"},F=e=>{let{size:n,color:s,style:o,...l}=e;const t=o?{...I,...o}:I;return(0,i.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...l,children:(0,i.jsx)("path",{d:"M942.4615936 284.62787926c-14.30911886-14.12709945-37.31996786-14.05468217-51.48229632 0.21920654L517.97142983 661.27810333 139.75544149 286.45003606c-14.30911886-14.16232846-37.31996786-14.05468217-51.51948344 0.21920654-14.16232846 14.30911886-14.05468217 37.35519687 0.21920654 51.51948345l401.99014627 398.34974663c0.61847666 0.61847666 1.41897273 0.76526706 2.03940637 1.34655658 0.14483342 0.14483342 0.18201941 0.32685283 0.32685283 0.47364324 7.09877874 7.02636259 16.38375538 10.55911595 25.63154489 10.55911595 9.35739278 0 18.75001458-3.60516949 25.85075143-10.77636551l398.34974663-401.99014628C956.84312974 321.8382427 956.73548345 298.7921647 942.4615936 284.62787926z",fill:r(s,0,"#333333")})})};F.defaultProps={size:18};const V=F,k={display:"block"},E=e=>{let{size:n,color:s,style:o,...l}=e;const t=o?{...k,...o}:k;return(0,i.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...l,children:(0,i.jsx)("path",{d:"M81.5384064 739.37212074c14.30911886 14.12709945 37.31996786 14.05468217 51.48229632-0.21920654L506.02857017 362.72189667 884.24455851 737.54996394c14.30911886 14.16232846 37.31996786 14.05468217 51.51948344-0.21920654 14.16232846-14.30911886 14.05468217-37.35519687-0.21920654-51.51948345l-401.99014627-398.34974663c-0.61847666-0.61847666-1.41897273-0.76526706-2.03940637-1.34655658-0.14483342-0.14483342-0.18201941-0.32685283-0.32685282-0.47364324-7.09877874-7.02636259-16.38375538-10.55911595-25.6315449-10.55911595-9.35739278 0-18.75001458 3.60516949-25.85075143 10.77636551l-398.34974663 401.99014628C67.15687026 702.1617573 67.26451655 725.2078353 81.5384064 739.37212074z",fill:r(s,0,"#333333")})})};E.defaultProps={size:18};const H=E,W=e=>{let{name:n,...s}=e;switch(n){case"youhua":return(0,i.jsx)(t,{...s});case"dayi":return(0,i.jsx)(a,{...s});case"shengji":return(0,i.jsx)(x,{...s});case"tiaozheng":return(0,i.jsx)(u,{...s});case"gengxin":return(0,i.jsx)(S,{...s});case"wendang":return(0,i.jsx)(J,{...s});case"shanchu":return(0,i.jsx)(w,{...s});case"bug":return(0,i.jsx)(T,{...s});case"xinzeng":return(0,i.jsx)(D,{...s});case"fuwu":return(0,i.jsx)(M,{...s});case"down":return(0,i.jsx)(V,{...s});case"up":return(0,i.jsx)(H,{...s})}return null},B={label:"label_p8vM",icon:"icon_knQK"};function G(e){const{children:n}=e,s={"\u65b0\u589e":{icon:"xinzeng",bgColor:"#39b54a"},"\u4fee\u590d":{icon:"bug",bgColor:"#9c26b0"},"\u6587\u6863":{icon:"wendang",bgColor:"rgb(79, 147, 255)"},"\u66f4\u65b0":{icon:"gengxin",bgColor:"#0081ff"},"\u8c03\u6574":{icon:"tiaozheng",bgColor:"#333"},"\u5347\u7ea7":{icon:"shengji",bgColor:"#e03997"},"\u79fb\u9664":{icon:"shanchu",bgColor:"#666"},"\u7b54\u7591":{icon:"dayi",bgColor:"#bbb"},"\u4f18\u5316":{icon:"youhua",bgColor:"#38e550"}};return(0,i.jsxs)("label",{className:B.label,title:n,style:{backgroundColor:s[n].bgColor},children:[(0,i.jsx)(W,{name:s[n].icon,color:"white",size:14,className:B.icon})," ",n]})}},1151:(e,n,s)=>{s.d(n,{Z:()=>t,a:()=>l});var r=s(7294);const i={},o=r.createContext(i);function l(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function t(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:l(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]);