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