[{"data":1,"prerenderedAt":788},["ShallowReactive",2],{"post-/blog/json-to-rust-struct":3,"related-/blog/json-to-rust-struct":188},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"category":11,"keywords":12,"body":16,"_type":182,"_id":183,"_source":184,"_file":185,"_stem":186,"_extension":187},"/blog/json-to-rust-struct","blog",false,"","JSON 转 Rust struct 教程","根据 JSON 生成 Rust 结构体与 serde derive，用于 Rust 后端建模。","2026-08-19","代码生成",[13,14,15],"json转rust","json to rust","serde",{"type":17,"children":18,"toc":174},"root",[19,27,33,39,44,50,63,68,131,136,158,163,168],{"type":20,"tag":21,"props":22,"children":24},"element","h1",{"id":23},"json-转-rust-struct-教程",[25],{"type":26,"value":8},"text",{"type":20,"tag":28,"props":29,"children":30},"p",{},[31],{"type":26,"value":32},"根据 JSON 生成 Rust 结构体，自动添加 serde derive 宏，用于 Rust 序列化。",{"type":20,"tag":34,"props":35,"children":37},"h2",{"id":36},"类型映射",[38],{"type":26,"value":36},{"type":20,"tag":28,"props":40,"children":41},{},[42],{"type":26,"value":43},"string→String、number→i64/f64、boolean→bool、array→Vec、object→嵌套 struct。",{"type":20,"tag":34,"props":45,"children":47},{"id":46},"serde-配置",[48],{"type":26,"value":49},"serde 配置",{"type":20,"tag":28,"props":51,"children":52},{},[53,55,61],{"type":26,"value":54},"生成 #",{"type":20,"tag":56,"props":57,"children":58},"span",{},[59],{"type":26,"value":60},"derive(Serialize, Deserialize)",{"type":26,"value":62}," 与 rename_all 处理命名。",{"type":20,"tag":34,"props":64,"children":66},{"id":65},"代码示例",[67],{"type":26,"value":65},{"type":20,"tag":69,"props":70,"children":74},"pre",{"className":71,"code":72,"language":73,"meta":7,"style":7},"language-json shiki shiki-themes github-dark","{\"id\": 1, \"name\": \"x\"}\n","json",[75],{"type":20,"tag":76,"props":77,"children":78},"code",{"__ignoreMap":7},[79],{"type":20,"tag":56,"props":80,"children":83},{"class":81,"line":82},"line",1,[84,90,96,101,106,111,116,120,126],{"type":20,"tag":56,"props":85,"children":87},{"style":86},"--shiki-default:#E1E4E8",[88],{"type":26,"value":89},"{",{"type":20,"tag":56,"props":91,"children":93},{"style":92},"--shiki-default:#79B8FF",[94],{"type":26,"value":95},"\"id\"",{"type":20,"tag":56,"props":97,"children":98},{"style":86},[99],{"type":26,"value":100},": ",{"type":20,"tag":56,"props":102,"children":103},{"style":92},[104],{"type":26,"value":105},"1",{"type":20,"tag":56,"props":107,"children":108},{"style":86},[109],{"type":26,"value":110},", ",{"type":20,"tag":56,"props":112,"children":113},{"style":92},[114],{"type":26,"value":115},"\"name\"",{"type":20,"tag":56,"props":117,"children":118},{"style":86},[119],{"type":26,"value":100},{"type":20,"tag":56,"props":121,"children":123},{"style":122},"--shiki-default:#9ECBFF",[124],{"type":26,"value":125},"\"x\"",{"type":20,"tag":56,"props":127,"children":128},{"style":86},[129],{"type":26,"value":130},"}\n",{"type":20,"tag":34,"props":132,"children":134},{"id":133},"推荐在线工具",[135],{"type":26,"value":133},{"type":20,"tag":137,"props":138,"children":139},"ul",{},[140,150],{"type":20,"tag":141,"props":142,"children":143},"li",{},[144],{"type":20,"tag":145,"props":146,"children":148},"a",{"href":147},"/codegen/java",[149],{"type":26,"value":147},{"type":20,"tag":141,"props":151,"children":152},{},[153],{"type":20,"tag":145,"props":154,"children":156},{"href":155},"/format",[157],{"type":26,"value":155},{"type":20,"tag":34,"props":159,"children":161},{"id":160},"小结",[162],{"type":26,"value":160},{"type":20,"tag":28,"props":164,"children":165},{},[166],{"type":26,"value":167},"根据 JSON 生成 Rust 结构体与 serde derive，用于 Rust 后端建模。 JSONDog 提供全套 JSON 在线工具，纯前端、零上传、中英双语，欢迎免费使用。",{"type":20,"tag":169,"props":170,"children":171},"style",{},[172],{"type":26,"value":173},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":7,"searchDepth":175,"depth":175,"links":176},2,[177,178,179,180,181],{"id":36,"depth":175,"text":36},{"id":46,"depth":175,"text":49},{"id":65,"depth":175,"text":65},{"id":133,"depth":175,"text":133},{"id":160,"depth":175,"text":160},"markdown","content:blog:json-to-rust-struct.md","content","blog/json-to-rust-struct.md","blog/json-to-rust-struct","md",[189,340,516,657],{"_path":190,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":191,"description":192,"date":10,"category":11,"keywords":193,"body":197,"_type":182,"_id":337,"_source":184,"_file":338,"_stem":339,"_extension":187},"/blog/json-to-csharp-class","JSON 转 C# 类教程","根据 JSON 生成 C# 类，用于 .NET 后端快速建模与反序列化。",[194,195,196],"json转csharp","json to c#","csharp class",{"type":17,"children":198,"toc":330},[199,204,209,213,218,223,228,232,296,300,317,321,326],{"type":20,"tag":21,"props":200,"children":202},{"id":201},"json-转-c-类教程",[203],{"type":26,"value":191},{"type":20,"tag":28,"props":205,"children":206},{},[207],{"type":26,"value":208},"根据 JSON 生成 C# 类定义，自动推断属性类型，用于 .NET 序列化建模。",{"type":20,"tag":34,"props":210,"children":211},{"id":36},[212],{"type":26,"value":36},{"type":20,"tag":28,"props":214,"children":215},{},[216],{"type":26,"value":217},"string→string、number→int/double、boolean→bool、array→List、object→嵌套类。",{"type":20,"tag":34,"props":219,"children":221},{"id":220},"使用建议",[222],{"type":26,"value":220},{"type":20,"tag":28,"props":224,"children":225},{},[226],{"type":26,"value":227},"可配合 Newtonsoft.Json 或 System.Text.Json 使用。",{"type":20,"tag":34,"props":229,"children":230},{"id":65},[231],{"type":26,"value":65},{"type":20,"tag":69,"props":233,"children":235},{"className":71,"code":234,"language":73,"meta":7,"style":7},"{\"id\": 1, \"name\": \"x\", \"price\": 9.9}\n",[236],{"type":20,"tag":76,"props":237,"children":238},{"__ignoreMap":7},[239],{"type":20,"tag":56,"props":240,"children":241},{"class":81,"line":82},[242,246,250,254,258,262,266,270,274,278,283,287,292],{"type":20,"tag":56,"props":243,"children":244},{"style":86},[245],{"type":26,"value":89},{"type":20,"tag":56,"props":247,"children":248},{"style":92},[249],{"type":26,"value":95},{"type":20,"tag":56,"props":251,"children":252},{"style":86},[253],{"type":26,"value":100},{"type":20,"tag":56,"props":255,"children":256},{"style":92},[257],{"type":26,"value":105},{"type":20,"tag":56,"props":259,"children":260},{"style":86},[261],{"type":26,"value":110},{"type":20,"tag":56,"props":263,"children":264},{"style":92},[265],{"type":26,"value":115},{"type":20,"tag":56,"props":267,"children":268},{"style":86},[269],{"type":26,"value":100},{"type":20,"tag":56,"props":271,"children":272},{"style":122},[273],{"type":26,"value":125},{"type":20,"tag":56,"props":275,"children":276},{"style":86},[277],{"type":26,"value":110},{"type":20,"tag":56,"props":279,"children":280},{"style":92},[281],{"type":26,"value":282},"\"price\"",{"type":20,"tag":56,"props":284,"children":285},{"style":86},[286],{"type":26,"value":100},{"type":20,"tag":56,"props":288,"children":289},{"style":92},[290],{"type":26,"value":291},"9.9",{"type":20,"tag":56,"props":293,"children":294},{"style":86},[295],{"type":26,"value":130},{"type":20,"tag":34,"props":297,"children":298},{"id":133},[299],{"type":26,"value":133},{"type":20,"tag":137,"props":301,"children":302},{},[303,310],{"type":20,"tag":141,"props":304,"children":305},{},[306],{"type":20,"tag":145,"props":307,"children":308},{"href":147},[309],{"type":26,"value":147},{"type":20,"tag":141,"props":311,"children":312},{},[313],{"type":20,"tag":145,"props":314,"children":315},{"href":155},[316],{"type":26,"value":155},{"type":20,"tag":34,"props":318,"children":319},{"id":160},[320],{"type":26,"value":160},{"type":20,"tag":28,"props":322,"children":323},{},[324],{"type":26,"value":325},"根据 JSON 生成 C# 类，用于 .NET 后端快速建模与反序列化。 JSONDog 提供全套 JSON 在线工具，纯前端、零上传、中英双语，欢迎免费使用。",{"type":20,"tag":169,"props":327,"children":328},{},[329],{"type":26,"value":173},{"title":7,"searchDepth":175,"depth":175,"links":331},[332,333,334,335,336],{"id":36,"depth":175,"text":36},{"id":220,"depth":175,"text":220},{"id":65,"depth":175,"text":65},{"id":133,"depth":175,"text":133},{"id":160,"depth":175,"text":160},"content:blog:json-to-csharp-class.md","blog/json-to-csharp-class.md","blog/json-to-csharp-class",{"_path":341,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":342,"description":343,"date":10,"category":11,"keywords":344,"body":348,"_type":182,"_id":513,"_source":184,"_file":514,"_stem":515,"_extension":187},"/blog/json-to-excel","JSON 转 Excel 教程","将 JSON 数据导出为 Excel xlsx 文件，用于数据分析与报表。",[345,346,347],"json转excel","json to xlsx","导出excel",{"type":17,"children":349,"toc":506},[350,355,360,365,370,375,380,384,470,474,493,497,502],{"type":20,"tag":21,"props":351,"children":353},{"id":352},"json-转-excel-教程",[354],{"type":26,"value":342},{"type":20,"tag":28,"props":356,"children":357},{},[358],{"type":26,"value":359},"将 JSON 数组导出为 Excel xlsx 文件，键作为列名，用于数据分析与报表分发。",{"type":20,"tag":34,"props":361,"children":363},{"id":362},"转换条件",[364],{"type":26,"value":362},{"type":20,"tag":28,"props":366,"children":367},{},[368],{"type":26,"value":369},"JSON 须为对象数组，每个对象的键作为列，值作为单元格。",{"type":20,"tag":34,"props":371,"children":373},{"id":372},"使用场景",[374],{"type":26,"value":372},{"type":20,"tag":28,"props":376,"children":377},{},[378],{"type":26,"value":379},"导出业务数据、生成报表、与 Excel 用户协作。",{"type":20,"tag":34,"props":381,"children":382},{"id":65},[383],{"type":26,"value":65},{"type":20,"tag":69,"props":385,"children":387},{"className":71,"code":386,"language":73,"meta":7,"style":7},"[{\"id\":1,\"name\":\"a\"},{\"id\":2,\"name\":\"b\"}]\n",[388],{"type":20,"tag":76,"props":389,"children":390},{"__ignoreMap":7},[391],{"type":20,"tag":56,"props":392,"children":393},{"class":81,"line":82},[394,399,403,408,412,417,421,425,430,435,439,443,448,452,456,460,465],{"type":20,"tag":56,"props":395,"children":396},{"style":86},[397],{"type":26,"value":398},"[{",{"type":20,"tag":56,"props":400,"children":401},{"style":92},[402],{"type":26,"value":95},{"type":20,"tag":56,"props":404,"children":405},{"style":86},[406],{"type":26,"value":407},":",{"type":20,"tag":56,"props":409,"children":410},{"style":92},[411],{"type":26,"value":105},{"type":20,"tag":56,"props":413,"children":414},{"style":86},[415],{"type":26,"value":416},",",{"type":20,"tag":56,"props":418,"children":419},{"style":92},[420],{"type":26,"value":115},{"type":20,"tag":56,"props":422,"children":423},{"style":86},[424],{"type":26,"value":407},{"type":20,"tag":56,"props":426,"children":427},{"style":122},[428],{"type":26,"value":429},"\"a\"",{"type":20,"tag":56,"props":431,"children":432},{"style":86},[433],{"type":26,"value":434},"},{",{"type":20,"tag":56,"props":436,"children":437},{"style":92},[438],{"type":26,"value":95},{"type":20,"tag":56,"props":440,"children":441},{"style":86},[442],{"type":26,"value":407},{"type":20,"tag":56,"props":444,"children":445},{"style":92},[446],{"type":26,"value":447},"2",{"type":20,"tag":56,"props":449,"children":450},{"style":86},[451],{"type":26,"value":416},{"type":20,"tag":56,"props":453,"children":454},{"style":92},[455],{"type":26,"value":115},{"type":20,"tag":56,"props":457,"children":458},{"style":86},[459],{"type":26,"value":407},{"type":20,"tag":56,"props":461,"children":462},{"style":122},[463],{"type":26,"value":464},"\"b\"",{"type":20,"tag":56,"props":466,"children":467},{"style":86},[468],{"type":26,"value":469},"}]\n",{"type":20,"tag":34,"props":471,"children":472},{"id":133},[473],{"type":26,"value":133},{"type":20,"tag":137,"props":475,"children":476},{},[477,485],{"type":20,"tag":141,"props":478,"children":479},{},[480],{"type":20,"tag":145,"props":481,"children":483},{"href":482},"/convert/csv",[484],{"type":26,"value":482},{"type":20,"tag":141,"props":486,"children":487},{},[488],{"type":20,"tag":145,"props":489,"children":491},{"href":490},"/flatten",[492],{"type":26,"value":490},{"type":20,"tag":34,"props":494,"children":495},{"id":160},[496],{"type":26,"value":160},{"type":20,"tag":28,"props":498,"children":499},{},[500],{"type":26,"value":501},"将 JSON 数据导出为 Excel xlsx 文件，用于数据分析与报表。 JSONDog 提供全套 JSON 在线工具，纯前端、零上传、中英双语，欢迎免费使用。",{"type":20,"tag":169,"props":503,"children":504},{},[505],{"type":26,"value":173},{"title":7,"searchDepth":175,"depth":175,"links":507},[508,509,510,511,512],{"id":362,"depth":175,"text":362},{"id":372,"depth":175,"text":372},{"id":65,"depth":175,"text":65},{"id":133,"depth":175,"text":133},{"id":160,"depth":175,"text":160},"content:blog:json-to-excel.md","blog/json-to-excel.md","blog/json-to-excel",{"_path":517,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":518,"description":519,"date":10,"category":11,"keywords":520,"body":524,"_type":182,"_id":654,"_source":184,"_file":655,"_stem":656,"_extension":187},"/blog/json-to-go-struct","JSON 转 Go struct 教程","根据 JSON 生成 Go 结构体，含 json tag，用于 Go 后端快速建模。",[521,522,523],"json转go","json to golang","go struct",{"type":17,"children":525,"toc":647},[526,531,536,540,545,551,564,568,613,617,634,638,643],{"type":20,"tag":21,"props":527,"children":529},{"id":528},"json-转-go-struct-教程",[530],{"type":26,"value":518},{"type":20,"tag":28,"props":532,"children":533},{},[534],{"type":26,"value":535},"根据 JSON 生成 Go 结构体定义，自动添加 json tag，用于 Go 后端反序列化建模。",{"type":20,"tag":34,"props":537,"children":538},{"id":36},[539],{"type":26,"value":36},{"type":20,"tag":28,"props":541,"children":542},{},[543],{"type":26,"value":544},"string→string、number→int/float64、boolean→bool、array→slice、object→嵌套 struct。",{"type":20,"tag":34,"props":546,"children":548},{"id":547},"tag-生成",[549],{"type":26,"value":550},"tag 生成",{"type":20,"tag":28,"props":552,"children":553},{},[554,556,562],{"type":26,"value":555},"默认生成 ",{"type":20,"tag":76,"props":557,"children":559},{"className":558},[],[560],{"type":26,"value":561},"json:\"key\"",{"type":26,"value":563}," tag，可选 omitempty。",{"type":20,"tag":34,"props":565,"children":566},{"id":65},[567],{"type":26,"value":65},{"type":20,"tag":69,"props":569,"children":570},{"className":71,"code":72,"language":73,"meta":7,"style":7},[571],{"type":20,"tag":76,"props":572,"children":573},{"__ignoreMap":7},[574],{"type":20,"tag":56,"props":575,"children":576},{"class":81,"line":82},[577,581,585,589,593,597,601,605,609],{"type":20,"tag":56,"props":578,"children":579},{"style":86},[580],{"type":26,"value":89},{"type":20,"tag":56,"props":582,"children":583},{"style":92},[584],{"type":26,"value":95},{"type":20,"tag":56,"props":586,"children":587},{"style":86},[588],{"type":26,"value":100},{"type":20,"tag":56,"props":590,"children":591},{"style":92},[592],{"type":26,"value":105},{"type":20,"tag":56,"props":594,"children":595},{"style":86},[596],{"type":26,"value":110},{"type":20,"tag":56,"props":598,"children":599},{"style":92},[600],{"type":26,"value":115},{"type":20,"tag":56,"props":602,"children":603},{"style":86},[604],{"type":26,"value":100},{"type":20,"tag":56,"props":606,"children":607},{"style":122},[608],{"type":26,"value":125},{"type":20,"tag":56,"props":610,"children":611},{"style":86},[612],{"type":26,"value":130},{"type":20,"tag":34,"props":614,"children":615},{"id":133},[616],{"type":26,"value":133},{"type":20,"tag":137,"props":618,"children":619},{},[620,627],{"type":20,"tag":141,"props":621,"children":622},{},[623],{"type":20,"tag":145,"props":624,"children":625},{"href":147},[626],{"type":26,"value":147},{"type":20,"tag":141,"props":628,"children":629},{},[630],{"type":20,"tag":145,"props":631,"children":632},{"href":155},[633],{"type":26,"value":155},{"type":20,"tag":34,"props":635,"children":636},{"id":160},[637],{"type":26,"value":160},{"type":20,"tag":28,"props":639,"children":640},{},[641],{"type":26,"value":642},"根据 JSON 生成 Go 结构体，含 json tag，用于 Go 后端快速建模。 JSONDog 提供全套 JSON 在线工具，纯前端、零上传、中英双语，欢迎免费使用。",{"type":20,"tag":169,"props":644,"children":645},{},[646],{"type":26,"value":173},{"title":7,"searchDepth":175,"depth":175,"links":648},[649,650,651,652,653],{"id":36,"depth":175,"text":36},{"id":547,"depth":175,"text":550},{"id":65,"depth":175,"text":65},{"id":133,"depth":175,"text":133},{"id":160,"depth":175,"text":160},"content:blog:json-to-go-struct.md","blog/json-to-go-struct.md","blog/json-to-go-struct",{"_path":658,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":659,"description":660,"date":10,"category":11,"keywords":661,"body":665,"_type":182,"_id":785,"_source":184,"_file":786,"_stem":787,"_extension":187},"/blog/json-to-graphql","JSON 转 GraphQL 教程","根据 JSON 结构生成 GraphQL type 定义，用于 GraphQL 服务建模。",[662,663,664],"json转graphql","graphql type","graphql",{"type":17,"children":666,"toc":778},[667,672,677,681,686,690,695,699,744,748,765,769,774],{"type":20,"tag":21,"props":668,"children":670},{"id":669},"json-转-graphql-教程",[671],{"type":26,"value":659},{"type":20,"tag":28,"props":673,"children":674},{},[675],{"type":26,"value":676},"根据 JSON 结构生成 GraphQL type 定义，用于 GraphQL 服务的 schema 建模。",{"type":20,"tag":34,"props":678,"children":679},{"id":36},[680],{"type":26,"value":36},{"type":20,"tag":28,"props":682,"children":683},{},[684],{"type":26,"value":685},"string→String、number→Int/Float、boolean→Boolean、array→列表类型、object→嵌套 type。",{"type":20,"tag":34,"props":687,"children":688},{"id":372},[689],{"type":26,"value":372},{"type":20,"tag":28,"props":691,"children":692},{},[693],{"type":26,"value":694},"快速为 GraphQL 服务生成 type 定义，减少手写。",{"type":20,"tag":34,"props":696,"children":697},{"id":65},[698],{"type":26,"value":65},{"type":20,"tag":69,"props":700,"children":701},{"className":71,"code":72,"language":73,"meta":7,"style":7},[702],{"type":20,"tag":76,"props":703,"children":704},{"__ignoreMap":7},[705],{"type":20,"tag":56,"props":706,"children":707},{"class":81,"line":82},[708,712,716,720,724,728,732,736,740],{"type":20,"tag":56,"props":709,"children":710},{"style":86},[711],{"type":26,"value":89},{"type":20,"tag":56,"props":713,"children":714},{"style":92},[715],{"type":26,"value":95},{"type":20,"tag":56,"props":717,"children":718},{"style":86},[719],{"type":26,"value":100},{"type":20,"tag":56,"props":721,"children":722},{"style":92},[723],{"type":26,"value":105},{"type":20,"tag":56,"props":725,"children":726},{"style":86},[727],{"type":26,"value":110},{"type":20,"tag":56,"props":729,"children":730},{"style":92},[731],{"type":26,"value":115},{"type":20,"tag":56,"props":733,"children":734},{"style":86},[735],{"type":26,"value":100},{"type":20,"tag":56,"props":737,"children":738},{"style":122},[739],{"type":26,"value":125},{"type":20,"tag":56,"props":741,"children":742},{"style":86},[743],{"type":26,"value":130},{"type":20,"tag":34,"props":745,"children":746},{"id":133},[747],{"type":26,"value":133},{"type":20,"tag":137,"props":749,"children":750},{},[751,758],{"type":20,"tag":141,"props":752,"children":753},{},[754],{"type":20,"tag":145,"props":755,"children":756},{"href":147},[757],{"type":26,"value":147},{"type":20,"tag":141,"props":759,"children":760},{},[761],{"type":20,"tag":145,"props":762,"children":763},{"href":155},[764],{"type":26,"value":155},{"type":20,"tag":34,"props":766,"children":767},{"id":160},[768],{"type":26,"value":160},{"type":20,"tag":28,"props":770,"children":771},{},[772],{"type":26,"value":773},"根据 JSON 结构生成 GraphQL type 定义，用于 GraphQL 服务建模。 JSONDog 提供全套 JSON 在线工具，纯前端、零上传、中英双语，欢迎免费使用。",{"type":20,"tag":169,"props":775,"children":776},{},[777],{"type":26,"value":173},{"title":7,"searchDepth":175,"depth":175,"links":779},[780,781,782,783,784],{"id":36,"depth":175,"text":36},{"id":372,"depth":175,"text":372},{"id":65,"depth":175,"text":65},{"id":133,"depth":175,"text":133},{"id":160,"depth":175,"text":160},"content:blog:json-to-graphql.md","blog/json-to-graphql.md","blog/json-to-graphql",1787305467577]