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