[{"data":1,"prerenderedAt":730},["ShallowReactive",2],{"post-/blog/json-performance":3,"related-/blog/json-performance":161},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"category":11,"keywords":12,"body":16,"_type":155,"_id":156,"_source":157,"_file":158,"_stem":159,"_extension":160},"/blog/json-performance","blog",false,"","JSON 性能优化技巧","大 JSON 解析与传输优化：压缩、流式解析、字段裁剪、二进制替代方案。","2026-08-19","进阶",[13,14,15],"json性能","json优化","大json",{"type":17,"children":18,"toc":147},"root",[19,27,33,39,44,49,54,59,104,109,131,136,141],{"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 的解析与传输可能成为性能瓶颈，可通过多种手段优化。",{"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},"传输前 minify、gzip 压缩、流式解析（SAX）、按需裁剪字段、考虑 Protobuf/MessagePack。",{"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},"选用高性能库（如 simdjson）、Web Worker 避免阻塞主线程。",{"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","{\"big\": \"data...\"}\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],{"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},"\"big\"",{"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},"\"data...\"",{"type":20,"tag":71,"props":100,"children":101},{"style":78},[102],{"type":26,"value":103},"}\n",{"type":20,"tag":34,"props":105,"children":107},{"id":106},"推荐在线工具",[108],{"type":26,"value":106},{"type":20,"tag":110,"props":111,"children":112},"ul",{},[113,123],{"type":20,"tag":114,"props":115,"children":116},"li",{},[117],{"type":20,"tag":118,"props":119,"children":121},"a",{"href":120},"/minify",[122],{"type":26,"value":120},{"type":20,"tag":114,"props":124,"children":125},{},[126],{"type":20,"tag":118,"props":127,"children":129},{"href":128},"/visualize",[130],{"type":26,"value":128},{"type":20,"tag":34,"props":132,"children":134},{"id":133},"小结",[135],{"type":26,"value":133},{"type":20,"tag":28,"props":137,"children":138},{},[139],{"type":26,"value":140},"大 JSON 解析与传输优化：压缩、流式解析、字段裁剪、二进制替代方案。 JSONDog 提供全套 JSON 在线工具，纯前端、零上传、中英双语，欢迎免费使用。",{"type":20,"tag":142,"props":143,"children":144},"style",{},[145],{"type":26,"value":146},"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":148,"depth":148,"links":149},2,[150,151,152,153,154],{"id":36,"depth":148,"text":36},{"id":46,"depth":148,"text":46},{"id":56,"depth":148,"text":56},{"id":106,"depth":148,"text":106},{"id":133,"depth":148,"text":133},"markdown","content:blog:json-performance.md","content","blog/json-performance.md","blog/json-performance","md",[162,342,465,625],{"_path":163,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":164,"description":165,"date":10,"category":11,"keywords":166,"body":170,"_type":155,"_id":339,"_source":157,"_file":340,"_stem":341,"_extension":160},"/blog/json-api-spec","JSON:API 规范指南","JSON:API 是 RESTful API 的数据响应规范，统一资源、关系、分页、错误格式。",[167,168,169],"json:api","json api规范","restful",{"type":17,"children":171,"toc":332},[172,177,182,187,192,197,202,206,296,300,319,323,328],{"type":20,"tag":21,"props":173,"children":175},{"id":174},"jsonapi-规范指南",[176],{"type":26,"value":164},{"type":20,"tag":28,"props":178,"children":179},{},[180],{"type":26,"value":181},"JSON:API 是一套构建 RESTful API 数据响应的规范，统一了资源对象、关系、分页与错误的 JSON 结构。",{"type":20,"tag":34,"props":183,"children":185},{"id":184},"核心约定",[186],{"type":26,"value":184},{"type":20,"tag":28,"props":188,"children":189},{},[190],{"type":26,"value":191},"data 包含资源数组或单对象，relationships 描述关联，included 包含关联资源，meta 存元信息。",{"type":20,"tag":34,"props":193,"children":195},{"id":194},"优势",[196],{"type":26,"value":194},{"type":20,"tag":28,"props":198,"children":199},{},[200],{"type":26,"value":201},"统一格式减少约定成本，客户端可通用化处理。",{"type":20,"tag":34,"props":203,"children":204},{"id":56},[205],{"type":26,"value":56},{"type":20,"tag":60,"props":207,"children":209},{"className":62,"code":208,"language":64,"meta":7,"style":7},"{\"data\": [{\"type\": \"user\", \"id\": \"1\", \"attributes\": {\"name\": \"x\"}}]}\n",[210],{"type":20,"tag":67,"props":211,"children":212},{"__ignoreMap":7},[213],{"type":20,"tag":71,"props":214,"children":215},{"class":73,"line":74},[216,220,225,230,235,239,244,249,254,258,263,267,272,277,282,286,291],{"type":20,"tag":71,"props":217,"children":218},{"style":78},[219],{"type":26,"value":81},{"type":20,"tag":71,"props":221,"children":222},{"style":84},[223],{"type":26,"value":224},"\"data\"",{"type":20,"tag":71,"props":226,"children":227},{"style":78},[228],{"type":26,"value":229},": [{",{"type":20,"tag":71,"props":231,"children":232},{"style":84},[233],{"type":26,"value":234},"\"type\"",{"type":20,"tag":71,"props":236,"children":237},{"style":78},[238],{"type":26,"value":92},{"type":20,"tag":71,"props":240,"children":241},{"style":95},[242],{"type":26,"value":243},"\"user\"",{"type":20,"tag":71,"props":245,"children":246},{"style":78},[247],{"type":26,"value":248},", ",{"type":20,"tag":71,"props":250,"children":251},{"style":84},[252],{"type":26,"value":253},"\"id\"",{"type":20,"tag":71,"props":255,"children":256},{"style":78},[257],{"type":26,"value":92},{"type":20,"tag":71,"props":259,"children":260},{"style":95},[261],{"type":26,"value":262},"\"1\"",{"type":20,"tag":71,"props":264,"children":265},{"style":78},[266],{"type":26,"value":248},{"type":20,"tag":71,"props":268,"children":269},{"style":84},[270],{"type":26,"value":271},"\"attributes\"",{"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},"\"name\"",{"type":20,"tag":71,"props":283,"children":284},{"style":78},[285],{"type":26,"value":92},{"type":20,"tag":71,"props":287,"children":288},{"style":95},[289],{"type":26,"value":290},"\"x\"",{"type":20,"tag":71,"props":292,"children":293},{"style":78},[294],{"type":26,"value":295},"}}]}\n",{"type":20,"tag":34,"props":297,"children":298},{"id":106},[299],{"type":26,"value":106},{"type":20,"tag":110,"props":301,"children":302},{},[303,311],{"type":20,"tag":114,"props":304,"children":305},{},[306],{"type":20,"tag":118,"props":307,"children":309},{"href":308},"/format",[310],{"type":26,"value":308},{"type":20,"tag":114,"props":312,"children":313},{},[314],{"type":20,"tag":118,"props":315,"children":317},{"href":316},"/validate",[318],{"type":26,"value":316},{"type":20,"tag":34,"props":320,"children":321},{"id":133},[322],{"type":26,"value":133},{"type":20,"tag":28,"props":324,"children":325},{},[326],{"type":26,"value":327},"JSON:API 是 RESTful API 的数据响应规范，统一资源、关系、分页、错误格式。 JSONDog 提供全套 JSON 在线工具，纯前端、零上传、中英双语，欢迎免费使用。",{"type":20,"tag":142,"props":329,"children":330},{},[331],{"type":26,"value":146},{"title":7,"searchDepth":148,"depth":148,"links":333},[334,335,336,337,338],{"id":184,"depth":148,"text":184},{"id":194,"depth":148,"text":194},{"id":56,"depth":148,"text":56},{"id":106,"depth":148,"text":106},{"id":133,"depth":148,"text":133},"content:blog:json-api-spec.md","blog/json-api-spec.md","blog/json-api-spec",{"_path":343,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":344,"description":345,"date":10,"category":11,"keywords":346,"body":350,"_type":155,"_id":462,"_source":157,"_file":463,"_stem":464,"_extension":160},"/blog/json-deserialization","JSON 反序列化注意事项","JSON 反序列化将字符串转为对象，需注意类型丢失、精度、安全与错误处理。",[347,348,349],"json反序列化","json parse","反序列化",{"type":17,"children":351,"toc":455},[352,357,362,367,372,377,382,386,421,425,442,446,451],{"type":20,"tag":21,"props":353,"children":355},{"id":354},"json-反序列化注意事项",[356],{"type":26,"value":344},{"type":20,"tag":28,"props":358,"children":359},{},[360],{"type":26,"value":361},"JSON 反序列化将 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},"大整数精度丢失（JS Number 限制）、日期需手动转换、类型信息丢失、非法 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},"避免 eval 解析（注入风险），使用 JSON.parse；注意原型链污染。",{"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},"JSON.parse('{\"a\":1}')\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,401,406,411,416],{"type":20,"tag":71,"props":397,"children":398},{"style":78},[399],{"type":26,"value":400},"JSON.parse('{",{"type":20,"tag":71,"props":402,"children":403},{"style":84},[404],{"type":26,"value":405},"\"a\"",{"type":20,"tag":71,"props":407,"children":408},{"style":78},[409],{"type":26,"value":410},":",{"type":20,"tag":71,"props":412,"children":413},{"style":84},[414],{"type":26,"value":415},"1",{"type":20,"tag":71,"props":417,"children":418},{"style":78},[419],{"type":26,"value":420},"}')\n",{"type":20,"tag":34,"props":422,"children":423},{"id":106},[424],{"type":26,"value":106},{"type":20,"tag":110,"props":426,"children":427},{},[428,435],{"type":20,"tag":114,"props":429,"children":430},{},[431],{"type":20,"tag":118,"props":432,"children":433},{"href":316},[434],{"type":26,"value":316},{"type":20,"tag":114,"props":436,"children":437},{},[438],{"type":20,"tag":118,"props":439,"children":440},{"href":308},[441],{"type":26,"value":308},{"type":20,"tag":34,"props":443,"children":444},{"id":133},[445],{"type":26,"value":133},{"type":20,"tag":28,"props":447,"children":448},{},[449],{"type":26,"value":450},"JSON 反序列化将字符串转为对象，需注意类型丢失、精度、安全与错误处理。 JSONDog 提供全套 JSON 在线工具，纯前端、零上传、中英双语，欢迎免费使用。",{"type":20,"tag":142,"props":452,"children":453},{},[454],{"type":26,"value":146},{"title":7,"searchDepth":148,"depth":148,"links":456},[457,458,459,460,461],{"id":364,"depth":148,"text":364},{"id":374,"depth":148,"text":374},{"id":56,"depth":148,"text":56},{"id":106,"depth":148,"text":106},{"id":133,"depth":148,"text":133},"content:blog:json-deserialization.md","blog/json-deserialization.md","blog/json-deserialization",{"_path":466,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":467,"description":468,"date":10,"category":11,"keywords":469,"body":473,"_type":155,"_id":622,"_source":157,"_file":623,"_stem":624,"_extension":160},"/blog/json-patch","JSON Patch 操作详解","JSON Patch (RFC 6902) 用一组操作描述 JSON 变更，支持 add/remove/replace/move/copy/test。",[470,471,472],"json patch","rfc 6902","json变更",{"type":17,"children":474,"toc":615},[475,480,485,490,495,500,505,509,580,584,602,606,611],{"type":20,"tag":21,"props":476,"children":478},{"id":477},"json-patch-操作详解",[479],{"type":26,"value":467},{"type":20,"tag":28,"props":481,"children":482},{},[483],{"type":26,"value":484},"JSON Patch 是 RFC 6902 定义的用操作数组描述 JSON 变更的格式，常用于增量更新与协同。",{"type":20,"tag":34,"props":486,"children":488},{"id":487},"操作类型",[489],{"type":26,"value":487},{"type":20,"tag":28,"props":491,"children":492},{},[493],{"type":26,"value":494},"add 添加、remove 删除、replace 替换、move 移动、copy 复制、test 测试。",{"type":20,"tag":34,"props":496,"children":498},{"id":497},"使用场景",[499],{"type":26,"value":497},{"type":20,"tag":28,"props":501,"children":502},{},[503],{"type":26,"value":504},"API 增量更新、协同编辑、版本差异表达。",{"type":20,"tag":34,"props":506,"children":507},{"id":56},[508],{"type":26,"value":56},{"type":20,"tag":60,"props":510,"children":512},{"className":62,"code":511,"language":64,"meta":7,"style":7},"[{\"op\":\"replace\",\"path\":\"/name\",\"value\":\"新值\"}]\n",[513],{"type":20,"tag":67,"props":514,"children":515},{"__ignoreMap":7},[516],{"type":20,"tag":71,"props":517,"children":518},{"class":73,"line":74},[519,524,529,533,538,543,548,552,557,561,566,570,575],{"type":20,"tag":71,"props":520,"children":521},{"style":78},[522],{"type":26,"value":523},"[{",{"type":20,"tag":71,"props":525,"children":526},{"style":84},[527],{"type":26,"value":528},"\"op\"",{"type":20,"tag":71,"props":530,"children":531},{"style":78},[532],{"type":26,"value":410},{"type":20,"tag":71,"props":534,"children":535},{"style":95},[536],{"type":26,"value":537},"\"replace\"",{"type":20,"tag":71,"props":539,"children":540},{"style":78},[541],{"type":26,"value":542},",",{"type":20,"tag":71,"props":544,"children":545},{"style":84},[546],{"type":26,"value":547},"\"path\"",{"type":20,"tag":71,"props":549,"children":550},{"style":78},[551],{"type":26,"value":410},{"type":20,"tag":71,"props":553,"children":554},{"style":95},[555],{"type":26,"value":556},"\"/name\"",{"type":20,"tag":71,"props":558,"children":559},{"style":78},[560],{"type":26,"value":542},{"type":20,"tag":71,"props":562,"children":563},{"style":84},[564],{"type":26,"value":565},"\"value\"",{"type":20,"tag":71,"props":567,"children":568},{"style":78},[569],{"type":26,"value":410},{"type":20,"tag":71,"props":571,"children":572},{"style":95},[573],{"type":26,"value":574},"\"新值\"",{"type":20,"tag":71,"props":576,"children":577},{"style":78},[578],{"type":26,"value":579},"}]\n",{"type":20,"tag":34,"props":581,"children":582},{"id":106},[583],{"type":26,"value":106},{"type":20,"tag":110,"props":585,"children":586},{},[587,595],{"type":20,"tag":114,"props":588,"children":589},{},[590],{"type":20,"tag":118,"props":591,"children":593},{"href":592},"/diff",[594],{"type":26,"value":592},{"type":20,"tag":114,"props":596,"children":597},{},[598],{"type":20,"tag":118,"props":599,"children":600},{"href":308},[601],{"type":26,"value":308},{"type":20,"tag":34,"props":603,"children":604},{"id":133},[605],{"type":26,"value":133},{"type":20,"tag":28,"props":607,"children":608},{},[609],{"type":26,"value":610},"JSON Patch (RFC 6902) 用一组操作描述 JSON 变更，支持 add/remove/replace/move/copy/test。 JSONDog 提供全套 JSON 在线工具，纯前端、零上传、中英双语，欢迎免费使用。",{"type":20,"tag":142,"props":612,"children":613},{},[614],{"type":26,"value":146},{"title":7,"searchDepth":148,"depth":148,"links":616},[617,618,619,620,621],{"id":487,"depth":148,"text":487},{"id":497,"depth":148,"text":497},{"id":56,"depth":148,"text":56},{"id":106,"depth":148,"text":106},{"id":133,"depth":148,"text":133},"content:blog:json-patch.md","blog/json-patch.md","blog/json-patch",{"_path":626,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":627,"description":628,"date":10,"category":11,"keywords":629,"body":633,"_type":155,"_id":727,"_source":157,"_file":728,"_stem":729,"_extension":160},"/blog/json-pointer","JSON Pointer 详解","JSON Pointer (RFC 6901) 用斜杠路径定位 JSON 节点，如 /a/b/0。",[630,631,632],"json pointer","rfc 6901","json路径",{"type":17,"children":634,"toc":720},[635,640,645,650,655,661,666,670,684,688,707,711,716],{"type":20,"tag":21,"props":636,"children":638},{"id":637},"json-pointer-详解",[639],{"type":26,"value":627},{"type":20,"tag":28,"props":641,"children":642},{},[643],{"type":26,"value":644},"JSON Pointer 是 RFC 6901 定义的用斜杠分隔路径定位 JSON 节点的语法，是 JSON Patch 的基础。",{"type":20,"tag":34,"props":646,"children":648},{"id":647},"语法",[649],{"type":26,"value":647},{"type":20,"tag":28,"props":651,"children":652},{},[653],{"type":26,"value":654},"以 / 开头，每段为键名或数组索引，如 /user/name、/list/0。特殊字符需转义。",{"type":20,"tag":34,"props":656,"children":658},{"id":657},"与-jsonpath-区别",[659],{"type":26,"value":660},"与 JSONPath 区别",{"type":20,"tag":28,"props":662,"children":663},{},[664],{"type":26,"value":665},"JSON Pointer 更简单，仅定位单一节点；JSONPath 支持通配与过滤，可返回多节点。",{"type":20,"tag":34,"props":667,"children":668},{"id":56},[669],{"type":26,"value":56},{"type":20,"tag":60,"props":671,"children":673},{"className":62,"code":672,"language":64,"meta":7,"style":7},"/user/address/city\n",[674],{"type":20,"tag":67,"props":675,"children":676},{"__ignoreMap":7},[677],{"type":20,"tag":71,"props":678,"children":679},{"class":73,"line":74},[680],{"type":20,"tag":71,"props":681,"children":682},{"style":78},[683],{"type":26,"value":672},{"type":20,"tag":34,"props":685,"children":686},{"id":106},[687],{"type":26,"value":106},{"type":20,"tag":110,"props":689,"children":690},{},[691,699],{"type":20,"tag":114,"props":692,"children":693},{},[694],{"type":20,"tag":118,"props":695,"children":697},{"href":696},"/jsonpath",[698],{"type":26,"value":696},{"type":20,"tag":114,"props":700,"children":701},{},[702],{"type":20,"tag":118,"props":703,"children":705},{"href":704},"/tree",[706],{"type":26,"value":704},{"type":20,"tag":34,"props":708,"children":709},{"id":133},[710],{"type":26,"value":133},{"type":20,"tag":28,"props":712,"children":713},{},[714],{"type":26,"value":715},"JSON Pointer (RFC 6901) 用斜杠路径定位 JSON 节点，如 /a/b/0。 JSONDog 提供全套 JSON 在线工具，纯前端、零上传、中英双语，欢迎免费使用。",{"type":20,"tag":142,"props":717,"children":718},{},[719],{"type":26,"value":146},{"title":7,"searchDepth":148,"depth":148,"links":721},[722,723,724,725,726],{"id":647,"depth":148,"text":647},{"id":657,"depth":148,"text":660},{"id":56,"depth":148,"text":56},{"id":106,"depth":148,"text":106},{"id":133,"depth":148,"text":133},"content:blog:json-pointer.md","blog/json-pointer.md","blog/json-pointer",1787305467036]