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