[{"data":1,"prerenderedAt":799},["ShallowReactive",2],{"post-/blog/json-to-xml-tutorial":3,"related-/blog/json-to-xml-tutorial":190},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"category":11,"keywords":12,"body":16,"_type":184,"_id":185,"_source":186,"_file":187,"_stem":188,"_extension":189},"/blog/json-to-xml-tutorial","blog",false,"","JSON 转 XML 教程","JSON 转 XML 用于与遗留系统交互，本文介绍转换规则与属性处理。","2026-08-19","工具",[13,14,15],"json转xml","json to xml","xml转换",{"type":17,"children":18,"toc":176},"root",[19,27,33,39,44,49,54,59,133,138,160,165,170],{"type":20,"tag":21,"props":22,"children":24},"element","h1",{"id":23},"json-转-xml-教程",[25],{"type":26,"value":8},"text",{"type":20,"tag":28,"props":29,"children":30},"p",{},[31],{"type":26,"value":32},"将 JSON 转为 XML 用于与遗留 Web Service 或配置系统交互，需注意结构映射。",{"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},"对象转元素、键转子元素或属性、数组转重复元素、值转文本节点。",{"type":20,"tag":34,"props":45,"children":47},{"id":46},"局限",[48],{"type":26,"value":46},{"type":20,"tag":28,"props":50,"children":51},{},[52],{"type":26,"value":53},"JSON 无属性概念，转 XML 时键名既可作元素也可作属性，需约定。",{"type":20,"tag":34,"props":55,"children":57},{"id":56},"代码示例",[58],{"type":26,"value":56},{"type":20,"tag":60,"props":61,"children":65},"pre",{"className":62,"code":63,"language":64,"meta":7,"style":7},"language-json shiki shiki-themes github-dark","{\"person\": {\"name\": \"张三\", \"age\": 28}}\n","json",[66],{"type":20,"tag":67,"props":68,"children":69},"code",{"__ignoreMap":7},[70],{"type":20,"tag":71,"props":72,"children":75},"span",{"class":73,"line":74},"line",1,[76,82,88,93,98,103,109,114,119,123,128],{"type":20,"tag":71,"props":77,"children":79},{"style":78},"--shiki-default:#E1E4E8",[80],{"type":26,"value":81},"{",{"type":20,"tag":71,"props":83,"children":85},{"style":84},"--shiki-default:#79B8FF",[86],{"type":26,"value":87},"\"person\"",{"type":20,"tag":71,"props":89,"children":90},{"style":78},[91],{"type":26,"value":92},": {",{"type":20,"tag":71,"props":94,"children":95},{"style":84},[96],{"type":26,"value":97},"\"name\"",{"type":20,"tag":71,"props":99,"children":100},{"style":78},[101],{"type":26,"value":102},": ",{"type":20,"tag":71,"props":104,"children":106},{"style":105},"--shiki-default:#9ECBFF",[107],{"type":26,"value":108},"\"张三\"",{"type":20,"tag":71,"props":110,"children":111},{"style":78},[112],{"type":26,"value":113},", ",{"type":20,"tag":71,"props":115,"children":116},{"style":84},[117],{"type":26,"value":118},"\"age\"",{"type":20,"tag":71,"props":120,"children":121},{"style":78},[122],{"type":26,"value":102},{"type":20,"tag":71,"props":124,"children":125},{"style":84},[126],{"type":26,"value":127},"28",{"type":20,"tag":71,"props":129,"children":130},{"style":78},[131],{"type":26,"value":132},"}}\n",{"type":20,"tag":34,"props":134,"children":136},{"id":135},"推荐在线工具",[137],{"type":26,"value":135},{"type":20,"tag":139,"props":140,"children":141},"ul",{},[142,152],{"type":20,"tag":143,"props":144,"children":145},"li",{},[146],{"type":20,"tag":147,"props":148,"children":150},"a",{"href":149},"/convert/xml",[151],{"type":26,"value":149},{"type":20,"tag":143,"props":153,"children":154},{},[155],{"type":20,"tag":147,"props":156,"children":158},{"href":157},"/format",[159],{"type":26,"value":157},{"type":20,"tag":34,"props":161,"children":163},{"id":162},"小结",[164],{"type":26,"value":162},{"type":20,"tag":28,"props":166,"children":167},{},[168],{"type":26,"value":169},"JSON 转 XML 用于与遗留系统交互，本文介绍转换规则与属性处理。 JSONDog 提供全套 JSON 在线工具，纯前端、零上传、中英双语，欢迎免费使用。",{"type":20,"tag":171,"props":172,"children":173},"style",{},[174],{"type":26,"value":175},"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":177,"depth":177,"links":178},2,[179,180,181,182,183],{"id":36,"depth":177,"text":36},{"id":46,"depth":177,"text":46},{"id":56,"depth":177,"text":56},{"id":135,"depth":177,"text":135},{"id":162,"depth":177,"text":162},"markdown","content:blog:json-to-xml-tutorial.md","content","blog/json-to-xml-tutorial.md","blog/json-to-xml-tutorial","md",[191,342,513,630],{"_path":192,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":193,"description":194,"date":10,"category":11,"keywords":195,"body":199,"_type":184,"_id":339,"_source":186,"_file":340,"_stem":341,"_extension":189},"/blog/how-to-format-json","如何格式化 JSON：美化与缩进","JSON 格式化（美化）是为 JSON 添加缩进与换行，提升可读性。本文介绍在线格式化方法。",[196,197,198],"json格式化","json美化","format json",{"type":17,"children":200,"toc":332},[201,206,211,216,221,226,231,235,297,301,319,323,328],{"type":20,"tag":21,"props":202,"children":204},{"id":203},"如何格式化-json美化与缩进",[205],{"type":26,"value":193},{"type":20,"tag":28,"props":207,"children":208},{},[209],{"type":26,"value":210},"JSON 格式化又称美化（beautify）或 pretty print，指为压缩的 JSON 添加缩进与换行，使其结构清晰易读。",{"type":20,"tag":34,"props":212,"children":214},{"id":213},"为什么格式化",[215],{"type":26,"value":213},{"type":20,"tag":28,"props":217,"children":218},{},[219],{"type":26,"value":220},"压缩 JSON 单行难读，格式化后层级清晰，便于调试与排查错误。",{"type":20,"tag":34,"props":222,"children":224},{"id":223},"如何操作",[225],{"type":26,"value":223},{"type":20,"tag":28,"props":227,"children":228},{},[229],{"type":26,"value":230},"粘贴 JSON 到格式化工具，选择缩进（2/4 空格或 Tab），一键生成美化结果。",{"type":20,"tag":34,"props":232,"children":233},{"id":56},[234],{"type":26,"value":56},{"type":20,"tag":60,"props":236,"children":238},{"className":62,"code":237,"language":64,"meta":7,"style":7},"{\"a\":1,\"b\":{\"c\":2}}\n",[239],{"type":20,"tag":67,"props":240,"children":241},{"__ignoreMap":7},[242],{"type":20,"tag":71,"props":243,"children":244},{"class":73,"line":74},[245,249,254,259,264,269,274,279,284,288,293],{"type":20,"tag":71,"props":246,"children":247},{"style":78},[248],{"type":26,"value":81},{"type":20,"tag":71,"props":250,"children":251},{"style":84},[252],{"type":26,"value":253},"\"a\"",{"type":20,"tag":71,"props":255,"children":256},{"style":78},[257],{"type":26,"value":258},":",{"type":20,"tag":71,"props":260,"children":261},{"style":84},[262],{"type":26,"value":263},"1",{"type":20,"tag":71,"props":265,"children":266},{"style":78},[267],{"type":26,"value":268},",",{"type":20,"tag":71,"props":270,"children":271},{"style":84},[272],{"type":26,"value":273},"\"b\"",{"type":20,"tag":71,"props":275,"children":276},{"style":78},[277],{"type":26,"value":278},":{",{"type":20,"tag":71,"props":280,"children":281},{"style":84},[282],{"type":26,"value":283},"\"c\"",{"type":20,"tag":71,"props":285,"children":286},{"style":78},[287],{"type":26,"value":258},{"type":20,"tag":71,"props":289,"children":290},{"style":84},[291],{"type":26,"value":292},"2",{"type":20,"tag":71,"props":294,"children":295},{"style":78},[296],{"type":26,"value":132},{"type":20,"tag":34,"props":298,"children":299},{"id":135},[300],{"type":26,"value":135},{"type":20,"tag":139,"props":302,"children":303},{},[304,311],{"type":20,"tag":143,"props":305,"children":306},{},[307],{"type":20,"tag":147,"props":308,"children":309},{"href":157},[310],{"type":26,"value":157},{"type":20,"tag":143,"props":312,"children":313},{},[314],{"type":20,"tag":147,"props":315,"children":317},{"href":316},"/minify",[318],{"type":26,"value":316},{"type":20,"tag":34,"props":320,"children":321},{"id":162},[322],{"type":26,"value":162},{"type":20,"tag":28,"props":324,"children":325},{},[326],{"type":26,"value":327},"JSON 格式化（美化）是为 JSON 添加缩进与换行，提升可读性。本文介绍在线格式化方法。 JSONDog 提供全套 JSON 在线工具，纯前端、零上传、中英双语，欢迎免费使用。",{"type":20,"tag":171,"props":329,"children":330},{},[331],{"type":26,"value":175},{"title":7,"searchDepth":177,"depth":177,"links":333},[334,335,336,337,338],{"id":213,"depth":177,"text":213},{"id":223,"depth":177,"text":223},{"id":56,"depth":177,"text":56},{"id":135,"depth":177,"text":135},{"id":162,"depth":177,"text":162},"content:blog:how-to-format-json.md","blog/how-to-format-json.md","blog/how-to-format-json",{"_path":343,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":344,"description":345,"date":10,"category":11,"keywords":346,"body":350,"_type":184,"_id":510,"_source":186,"_file":511,"_stem":512,"_extension":189},"/blog/how-to-minify-json","如何压缩 JSON：Minify","JSON 压缩去除所有空白与换行，减小体积，用于生产环境传输。",[347,348,349],"json压缩","json minify","compress json",{"type":17,"children":351,"toc":503},[352,357,362,367,372,377,382,386,469,473,490,494,499],{"type":20,"tag":21,"props":353,"children":355},{"id":354},"如何压缩-jsonminify",[356],{"type":26,"value":344},{"type":20,"tag":28,"props":358,"children":359},{},[360],{"type":26,"value":361},"JSON 压缩（minify）去除所有不必要的空白、换行与缩进，将 JSON 压成单行，减小传输体积。",{"type":20,"tag":34,"props":363,"children":365},{"id":364},"压缩好处",[366],{"type":26,"value":364},{"type":20,"tag":28,"props":368,"children":369},{},[370],{"type":26,"value":371},"减小文件体积，加快网络传输，节省存储空间，适合生产环境。",{"type":20,"tag":34,"props":373,"children":375},{"id":374},"开发建议",[376],{"type":26,"value":374},{"type":20,"tag":28,"props":378,"children":379},{},[380],{"type":26,"value":381},"开发时用格式化便于阅读，部署时用压缩优化性能。",{"type":20,"tag":34,"props":383,"children":384},{"id":56},[385],{"type":26,"value":56},{"type":20,"tag":60,"props":387,"children":389},{"className":62,"code":388,"language":64,"meta":7,"style":7},"{\"a\":1,\"b\":[2,3],\"c\":{\"d\":4}}\n",[390],{"type":20,"tag":67,"props":391,"children":392},{"__ignoreMap":7},[393],{"type":20,"tag":71,"props":394,"children":395},{"class":73,"line":74},[396,400,404,408,412,416,420,425,429,433,438,443,447,451,456,460,465],{"type":20,"tag":71,"props":397,"children":398},{"style":78},[399],{"type":26,"value":81},{"type":20,"tag":71,"props":401,"children":402},{"style":84},[403],{"type":26,"value":253},{"type":20,"tag":71,"props":405,"children":406},{"style":78},[407],{"type":26,"value":258},{"type":20,"tag":71,"props":409,"children":410},{"style":84},[411],{"type":26,"value":263},{"type":20,"tag":71,"props":413,"children":414},{"style":78},[415],{"type":26,"value":268},{"type":20,"tag":71,"props":417,"children":418},{"style":84},[419],{"type":26,"value":273},{"type":20,"tag":71,"props":421,"children":422},{"style":78},[423],{"type":26,"value":424},":[",{"type":20,"tag":71,"props":426,"children":427},{"style":84},[428],{"type":26,"value":292},{"type":20,"tag":71,"props":430,"children":431},{"style":78},[432],{"type":26,"value":268},{"type":20,"tag":71,"props":434,"children":435},{"style":84},[436],{"type":26,"value":437},"3",{"type":20,"tag":71,"props":439,"children":440},{"style":78},[441],{"type":26,"value":442},"],",{"type":20,"tag":71,"props":444,"children":445},{"style":84},[446],{"type":26,"value":283},{"type":20,"tag":71,"props":448,"children":449},{"style":78},[450],{"type":26,"value":278},{"type":20,"tag":71,"props":452,"children":453},{"style":84},[454],{"type":26,"value":455},"\"d\"",{"type":20,"tag":71,"props":457,"children":458},{"style":78},[459],{"type":26,"value":258},{"type":20,"tag":71,"props":461,"children":462},{"style":84},[463],{"type":26,"value":464},"4",{"type":20,"tag":71,"props":466,"children":467},{"style":78},[468],{"type":26,"value":132},{"type":20,"tag":34,"props":470,"children":471},{"id":135},[472],{"type":26,"value":135},{"type":20,"tag":139,"props":474,"children":475},{},[476,483],{"type":20,"tag":143,"props":477,"children":478},{},[479],{"type":20,"tag":147,"props":480,"children":481},{"href":316},[482],{"type":26,"value":316},{"type":20,"tag":143,"props":484,"children":485},{},[486],{"type":20,"tag":147,"props":487,"children":488},{"href":157},[489],{"type":26,"value":157},{"type":20,"tag":34,"props":491,"children":492},{"id":162},[493],{"type":26,"value":162},{"type":20,"tag":28,"props":495,"children":496},{},[497],{"type":26,"value":498},"JSON 压缩去除所有空白与换行，减小体积，用于生产环境传输。 JSONDog 提供全套 JSON 在线工具，纯前端、零上传、中英双语，欢迎免费使用。",{"type":20,"tag":171,"props":500,"children":501},{},[502],{"type":26,"value":175},{"title":7,"searchDepth":177,"depth":177,"links":504},[505,506,507,508,509],{"id":364,"depth":177,"text":364},{"id":374,"depth":177,"text":374},{"id":56,"depth":177,"text":56},{"id":135,"depth":177,"text":135},{"id":162,"depth":177,"text":162},"content:blog:how-to-minify-json.md","blog/how-to-minify-json.md","blog/how-to-minify-json",{"_path":514,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":515,"description":516,"date":10,"category":11,"keywords":517,"body":521,"_type":184,"_id":627,"_source":186,"_file":628,"_stem":629,"_extension":189},"/blog/how-to-validate-json","如何校验 JSON 语法","JSON 校验检查语法是否合法，定位错误行号并给出修复建议。",[518,519,520],"json校验","json验证","validate json",{"type":17,"children":522,"toc":620},[523,528,533,538,543,548,553,557,585,589,607,611,616],{"type":20,"tag":21,"props":524,"children":526},{"id":525},"如何校验-json-语法",[527],{"type":26,"value":515},{"type":20,"tag":28,"props":529,"children":530},{},[531],{"type":26,"value":532},"JSON 校验用于检查 JSON 文本是否符合语法规范，发现错误并定位到具体行列。",{"type":20,"tag":34,"props":534,"children":536},{"id":535},"常见错误",[537],{"type":26,"value":535},{"type":20,"tag":28,"props":539,"children":540},{},[541],{"type":26,"value":542},"单引号、尾逗号、缺引号、缺逗号是高频错误，校验工具会指出位置与原因。",{"type":20,"tag":34,"props":544,"children":546},{"id":545},"校验工具",[547],{"type":26,"value":545},{"type":20,"tag":28,"props":549,"children":550},{},[551],{"type":26,"value":552},"粘贴 JSON 即时校验，合法显示美化预览，非法显示错误行号与修复建议。",{"type":20,"tag":34,"props":554,"children":555},{"id":56},[556],{"type":26,"value":56},{"type":20,"tag":60,"props":558,"children":560},{"className":62,"code":559,"language":64,"meta":7,"style":7},"{\"bad\": \"missing quote}\n",[561],{"type":20,"tag":67,"props":562,"children":563},{"__ignoreMap":7},[564],{"type":20,"tag":71,"props":565,"children":566},{"class":73,"line":74},[567,571,576,580],{"type":20,"tag":71,"props":568,"children":569},{"style":78},[570],{"type":26,"value":81},{"type":20,"tag":71,"props":572,"children":573},{"style":84},[574],{"type":26,"value":575},"\"bad\"",{"type":20,"tag":71,"props":577,"children":578},{"style":78},[579],{"type":26,"value":102},{"type":20,"tag":71,"props":581,"children":582},{"style":105},[583],{"type":26,"value":584},"\"missing quote}\n",{"type":20,"tag":34,"props":586,"children":587},{"id":135},[588],{"type":26,"value":135},{"type":20,"tag":139,"props":590,"children":591},{},[592,600],{"type":20,"tag":143,"props":593,"children":594},{},[595],{"type":20,"tag":147,"props":596,"children":598},{"href":597},"/validate",[599],{"type":26,"value":597},{"type":20,"tag":143,"props":601,"children":602},{},[603],{"type":20,"tag":147,"props":604,"children":605},{"href":157},[606],{"type":26,"value":157},{"type":20,"tag":34,"props":608,"children":609},{"id":162},[610],{"type":26,"value":162},{"type":20,"tag":28,"props":612,"children":613},{},[614],{"type":26,"value":615},"JSON 校验检查语法是否合法，定位错误行号并给出修复建议。 JSONDog 提供全套 JSON 在线工具，纯前端、零上传、中英双语，欢迎免费使用。",{"type":20,"tag":171,"props":617,"children":618},{},[619],{"type":26,"value":175},{"title":7,"searchDepth":177,"depth":177,"links":621},[622,623,624,625,626],{"id":535,"depth":177,"text":535},{"id":545,"depth":177,"text":545},{"id":56,"depth":177,"text":56},{"id":135,"depth":177,"text":135},{"id":162,"depth":177,"text":162},"content:blog:how-to-validate-json.md","blog/how-to-validate-json.md","blog/how-to-validate-json",{"_path":631,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":632,"description":633,"date":10,"category":11,"keywords":634,"body":638,"_type":184,"_id":796,"_source":186,"_file":797,"_stem":798,"_extension":189},"/blog/json-diff-compare","JSON 对比与差异分析","JSON 对比工具递归比较两段 JSON，输出新增、删除、修改的节点路径。",[635,636,637],"json对比","json diff","json compare",{"type":17,"children":639,"toc":789},[640,645,650,655,660,665,670,674,754,758,776,780,785],{"type":20,"tag":21,"props":641,"children":643},{"id":642},"json-对比与差异分析",[644],{"type":26,"value":632},{"type":20,"tag":28,"props":646,"children":647},{},[648],{"type":26,"value":649},"JSON 对比工具递归比较两段 JSON 的差异，输出每个新增、删除、修改节点的路径，便于排查变更。",{"type":20,"tag":34,"props":651,"children":653},{"id":652},"对比规则",[654],{"type":26,"value":652},{"type":20,"tag":28,"props":656,"children":657},{},[658],{"type":26,"value":659},"对象按键名比较不区分顺序，数组按索引比较，基本值按相等比较。",{"type":20,"tag":34,"props":661,"children":663},{"id":662},"使用场景",[664],{"type":26,"value":662},{"type":20,"tag":28,"props":666,"children":667},{},[668],{"type":26,"value":669},"对比 API 两次返回、排查配置变更、版本差异分析。",{"type":20,"tag":34,"props":671,"children":672},{"id":56},[673],{"type":26,"value":56},{"type":20,"tag":60,"props":675,"children":677},{"className":62,"code":676,"language":64,"meta":7,"style":7},"{\"a\":1,\"b\":2} vs {\"a\":1,\"c\":3}\n",[678],{"type":20,"tag":67,"props":679,"children":680},{"__ignoreMap":7},[681],{"type":20,"tag":71,"props":682,"children":683},{"class":73,"line":74},[684,688,692,696,700,704,708,712,716,721,725,729,733,737,741,745,749],{"type":20,"tag":71,"props":685,"children":686},{"style":78},[687],{"type":26,"value":81},{"type":20,"tag":71,"props":689,"children":690},{"style":84},[691],{"type":26,"value":253},{"type":20,"tag":71,"props":693,"children":694},{"style":78},[695],{"type":26,"value":258},{"type":20,"tag":71,"props":697,"children":698},{"style":84},[699],{"type":26,"value":263},{"type":20,"tag":71,"props":701,"children":702},{"style":78},[703],{"type":26,"value":268},{"type":20,"tag":71,"props":705,"children":706},{"style":84},[707],{"type":26,"value":273},{"type":20,"tag":71,"props":709,"children":710},{"style":78},[711],{"type":26,"value":258},{"type":20,"tag":71,"props":713,"children":714},{"style":84},[715],{"type":26,"value":292},{"type":20,"tag":71,"props":717,"children":718},{"style":78},[719],{"type":26,"value":720},"} vs {",{"type":20,"tag":71,"props":722,"children":723},{"style":84},[724],{"type":26,"value":253},{"type":20,"tag":71,"props":726,"children":727},{"style":78},[728],{"type":26,"value":258},{"type":20,"tag":71,"props":730,"children":731},{"style":84},[732],{"type":26,"value":263},{"type":20,"tag":71,"props":734,"children":735},{"style":78},[736],{"type":26,"value":268},{"type":20,"tag":71,"props":738,"children":739},{"style":84},[740],{"type":26,"value":283},{"type":20,"tag":71,"props":742,"children":743},{"style":78},[744],{"type":26,"value":258},{"type":20,"tag":71,"props":746,"children":747},{"style":84},[748],{"type":26,"value":437},{"type":20,"tag":71,"props":750,"children":751},{"style":78},[752],{"type":26,"value":753},"}\n",{"type":20,"tag":34,"props":755,"children":756},{"id":135},[757],{"type":26,"value":135},{"type":20,"tag":139,"props":759,"children":760},{},[761,769],{"type":20,"tag":143,"props":762,"children":763},{},[764],{"type":20,"tag":147,"props":765,"children":767},{"href":766},"/diff",[768],{"type":26,"value":766},{"type":20,"tag":143,"props":770,"children":771},{},[772],{"type":20,"tag":147,"props":773,"children":774},{"href":157},[775],{"type":26,"value":157},{"type":20,"tag":34,"props":777,"children":778},{"id":162},[779],{"type":26,"value":162},{"type":20,"tag":28,"props":781,"children":782},{},[783],{"type":26,"value":784},"JSON 对比工具递归比较两段 JSON，输出新增、删除、修改的节点路径。 JSONDog 提供全套 JSON 在线工具，纯前端、零上传、中英双语，欢迎免费使用。",{"type":20,"tag":171,"props":786,"children":787},{},[788],{"type":26,"value":175},{"title":7,"searchDepth":177,"depth":177,"links":790},[791,792,793,794,795],{"id":652,"depth":177,"text":652},{"id":662,"depth":177,"text":662},{"id":56,"depth":177,"text":56},{"id":135,"depth":177,"text":135},{"id":162,"depth":177,"text":162},"content:blog:json-diff-compare.md","blog/json-diff-compare.md","blog/json-diff-compare",1787305468374]