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