You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
4.6 KiB
JavaScript
1 line
4.6 KiB
JavaScript
"use strict";(self.webpackChunkfurion=self.webpackChunkfurion||[]).push([[4667],{836:(e,i,n)=>{n.r(i),n.d(i,{assets:()=>a,contentTitle:()=>l,default:()=>u,frontMatter:()=>t,metadata:()=>o,toc:()=>d});var r=n(5893),s=n(1151);const t={id:"jsonserializer",title:"7. JsonSerializerUtility \u9759\u6001\u7c7b",sidebar_label:"7. JsonSerializerUtility \u9759\u6001\u7c7b"},l=void 0,o={id:"global/jsonserializer",title:"7. JsonSerializerUtility \u9759\u6001\u7c7b",description:"\u4ee5\u4e0b\u5185\u5bb9\u5728 Furion 1.16.0 + \u7248\u672c\u4e2d\u5df2\u79fb\u9664\u3002\u8bf7\u4f7f\u7528 \u301023. JSON \u5e8f\u5217\u5316\u7ae0\u8282\u3011",source:"@site/docs/global/jsonserializer.mdx",sourceDirName:"global",slug:"/global/jsonserializer",permalink:"/docs/global/jsonserializer",draft:!1,unlisted:!1,editUrl:"https://gitee.com/dotnetchina/Furion/tree/v4/handbook/docs/global/jsonserializer.mdx",tags:[],version:"current",lastUpdatedBy:"MonkSoul",lastUpdatedAt:1668409773,formattedLastUpdatedAt:"Nov 14, 2022",frontMatter:{id:"jsonserializer",title:"7. JsonSerializerUtility \u9759\u6001\u7c7b",sidebar_label:"7. JsonSerializerUtility \u9759\u6001\u7c7b"},sidebar:"global",previous:{title:"6. Http \u9759\u6001\u7c7b",permalink:"/docs/global/shttp"},next:{title:"8. L \u9759\u6001\u7c7b",permalink:"/docs/global/l"}},a={},d=[{value:"7.1 \u5e8f\u5217\u5316",id:"71-\u5e8f\u5217\u5316",level:2},{value:"7.2 \u53cd\u5e8f\u5217\u5316",id:"72-\u53cd\u5e8f\u5217\u5316",level:2},{value:"7.3 \u83b7\u53d6\u9ed8\u8ba4\u5e8f\u5217\u5316\u914d\u7f6e",id:"73-\u83b7\u53d6\u9ed8\u8ba4\u5e8f\u5217\u5316\u914d\u7f6e",level:2},{value:"7.4 \u8bbe\u7f6e\u5e8f\u5217\u5316\u5c5e\u6027\u9996\u5b57\u6bcd\u5927\u5199",id:"74-\u8bbe\u7f6e\u5e8f\u5217\u5316\u5c5e\u6027\u9996\u5b57\u6bcd\u5927\u5199",level:2},{value:"7.5 \u8bbe\u7f6e\u65f6\u95f4\u8f93\u51fa\u7edf\u4e00\u683c\u5f0f\u5316",id:"75-\u8bbe\u7f6e\u65f6\u95f4\u8f93\u51fa\u7edf\u4e00\u683c\u5f0f\u5316",level:2}];function c(e){const i={a:"a",admonition:"admonition",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.admonition,{title:"\u91cd\u8981\u58f0\u660e",type:"warning",children:(0,r.jsxs)(i.p,{children:["\u4ee5\u4e0b\u5185\u5bb9\u5728 ",(0,r.jsx)(i.code,{children:"Furion 1.16.0 +"})," \u7248\u672c\u4e2d\u5df2\u79fb\u9664\u3002\u8bf7\u4f7f\u7528 ",(0,r.jsx)(i.a,{href:"/docs/json-serialization",children:"\u301023. JSON \u5e8f\u5217\u5316\u7ae0\u8282\u3011"})]})}),"\n",(0,r.jsx)(i.h2,{id:"71-\u5e8f\u5217\u5316",children:"7.1 \u5e8f\u5217\u5316"}),"\n",(0,r.jsx)(i.pre,{children:(0,r.jsx)(i.code,{className:"language-cs",metastring:"showLineNumbers",children:"var str = JsonSerializerUtility.Serialize(obj, [options]);\n"})}),"\n",(0,r.jsx)(i.h2,{id:"72-\u53cd\u5e8f\u5217\u5316",children:"7.2 \u53cd\u5e8f\u5217\u5316"}),"\n",(0,r.jsx)(i.pre,{children:(0,r.jsx)(i.code,{className:"language-cs",metastring:"showLineNumbers",children:"var obj = JsonSerializerUtility.Deserialize<T>(str, [options]);\n"})}),"\n",(0,r.jsx)(i.h2,{id:"73-\u83b7\u53d6\u9ed8\u8ba4\u5e8f\u5217\u5316\u914d\u7f6e",children:"7.3 \u83b7\u53d6\u9ed8\u8ba4\u5e8f\u5217\u5316\u914d\u7f6e"}),"\n",(0,r.jsx)(i.pre,{children:(0,r.jsx)(i.code,{className:"language-cs",metastring:"showLineNumbers",children:"var options = JsonSerializerUtility.GetDefaultJsonSerializerOptions();\n"})}),"\n",(0,r.jsx)(i.h2,{id:"74-\u8bbe\u7f6e\u5e8f\u5217\u5316\u5c5e\u6027\u9996\u5b57\u6bcd\u5927\u5199",children:"7.4 \u8bbe\u7f6e\u5e8f\u5217\u5316\u5c5e\u6027\u9996\u5b57\u6bcd\u5927\u5199"}),"\n",(0,r.jsx)(i.pre,{children:(0,r.jsx)(i.code,{className:"language-cs",metastring:"showLineNumbers {2}",children:"services.AddControllersWithViews()\r\n .AddJsonSerializerPascalPropertyNaming();\n"})}),"\n",(0,r.jsx)(i.h2,{id:"75-\u8bbe\u7f6e\u65f6\u95f4\u8f93\u51fa\u7edf\u4e00\u683c\u5f0f\u5316",children:"7.5 \u8bbe\u7f6e\u65f6\u95f4\u8f93\u51fa\u7edf\u4e00\u683c\u5f0f\u5316"}),"\n",(0,r.jsx)(i.pre,{children:(0,r.jsx)(i.code,{className:"language-cs",metastring:"showLineNumbers {2}",children:'services.AddControllersWithViews()\r\n .AddDateTimeJsonConverter("yyyy-MM-dd HH:mm:ss");\n'})})]})}function u(e={}){const{wrapper:i}={...(0,s.a)(),...e.components};return i?(0,r.jsx)(i,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},1151:(e,i,n)=>{n.d(i,{Z:()=>o,a:()=>l});var r=n(7294);const s={},t=r.createContext(s);function l(e){const i=r.useContext(t);return r.useMemo((function(){return"function"==typeof e?e(i):{...i,...e}}),[i,e])}function o(e){let i;return i=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:l(e.components),r.createElement(t.Provider,{value:i},e.children)}}}]); |