[{"data":1,"prerenderedAt":802},["ShallowReactive",2],{"post-/blog/json-i18n":3,"related-/blog/json-i18n":180},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"category":11,"keywords":12,"body":16,"_type":174,"_id":175,"_source":176,"_file":177,"_stem":178,"_extension":179},"/blog/json-i18n","blog",false,"","JSON 与国际化方案","JSON 是 i18n 资源文件常用格式，按语言分文件，键值映射文案。","2026-08-19","场景",[13,14,15],"json i18n","国际化json","多语言json",{"type":17,"children":18,"toc":166},"root",[19,27,33,39,44,49,54,59,123,128,150,155,160],{"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},"按语言分文件（en.json、zh.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},"前端 i18n 库加载对应语言 JSON，按键取文案，支持插值与复数。",{"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","{\"welcome\": \"欢迎\", \"login\": \"登录\"}\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,113,118],{"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},"\"welcome\"",{"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},"\"欢迎\"",{"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},"\"login\"",{"type":20,"tag":71,"props":110,"children":111},{"style":78},[112],{"type":26,"value":92},{"type":20,"tag":71,"props":114,"children":115},{"style":95},[116],{"type":26,"value":117},"\"登录\"",{"type":20,"tag":71,"props":119,"children":120},{"style":78},[121],{"type":26,"value":122},"}\n",{"type":20,"tag":34,"props":124,"children":126},{"id":125},"推荐在线工具",[127],{"type":26,"value":125},{"type":20,"tag":129,"props":130,"children":131},"ul",{},[132,142],{"type":20,"tag":133,"props":134,"children":135},"li",{},[136],{"type":20,"tag":137,"props":138,"children":140},"a",{"href":139},"/format",[141],{"type":26,"value":139},{"type":20,"tag":133,"props":143,"children":144},{},[145],{"type":20,"tag":137,"props":146,"children":148},{"href":147},"/validate",[149],{"type":26,"value":147},{"type":20,"tag":34,"props":151,"children":153},{"id":152},"小结",[154],{"type":26,"value":152},{"type":20,"tag":28,"props":156,"children":157},{},[158],{"type":26,"value":159},"JSON 是 i18n 资源文件常用格式，按语言分文件，键值映射文案。 JSONDog 提供全套 JSON 在线工具，纯前端、零上传、中英双语，欢迎免费使用。",{"type":20,"tag":161,"props":162,"children":163},"style",{},[164],{"type":26,"value":165},"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":167,"depth":167,"links":168},2,[169,170,171,172,173],{"id":36,"depth":167,"text":36},{"id":46,"depth":167,"text":46},{"id":56,"depth":167,"text":56},{"id":125,"depth":167,"text":125},{"id":152,"depth":167,"text":152},"markdown","content:blog:json-i18n.md","content","blog/json-i18n.md","blog/json-i18n","md",[181,332,471,636],{"_path":182,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":183,"description":184,"date":10,"category":11,"keywords":185,"body":189,"_type":174,"_id":329,"_source":176,"_file":330,"_stem":331,"_extension":179},"/blog/json-as-config","JSON 作为配置文件","JSON 常用作配置文件，但不支持注释，可考虑 JSON5 或 JSONC 替代。",[186,187,188],"json配置","json config","jsonc",{"type":17,"children":190,"toc":322},[191,196,201,206,211,216,221,225,288,292,309,313,318],{"type":20,"tag":21,"props":192,"children":194},{"id":193},"json-作为配置文件",[195],{"type":26,"value":183},{"type":20,"tag":28,"props":197,"children":198},{},[199],{"type":26,"value":200},"JSON 常用作配置文件（如 tsconfig、package.json），但不支持注释，编辑不便。",{"type":20,"tag":34,"props":202,"children":204},{"id":203},"优缺点",[205],{"type":26,"value":203},{"type":20,"tag":28,"props":207,"children":208},{},[209],{"type":26,"value":210},"优点：标准、解析快、跨语言；缺点：无注释、无多行字符串、尾逗号非法。",{"type":20,"tag":34,"props":212,"children":214},{"id":213},"替代方案",[215],{"type":26,"value":213},{"type":20,"tag":28,"props":217,"children":218},{},[219],{"type":26,"value":220},"JSON5、JSONC（带注释）、YAML、TOML 更适合人工编辑的配置。",{"type":20,"tag":34,"props":222,"children":223},{"id":56},[224],{"type":26,"value":56},{"type":20,"tag":60,"props":226,"children":228},{"className":62,"code":227,"language":64,"meta":7,"style":7},"{\n  \"compilerOptions\": {\n    \"target\": \"es2020\"\n  }\n}\n",[229],{"type":20,"tag":67,"props":230,"children":231},{"__ignoreMap":7},[232,240,253,271,280],{"type":20,"tag":71,"props":233,"children":234},{"class":73,"line":74},[235],{"type":20,"tag":71,"props":236,"children":237},{"style":78},[238],{"type":26,"value":239},"{\n",{"type":20,"tag":71,"props":241,"children":242},{"class":73,"line":167},[243,248],{"type":20,"tag":71,"props":244,"children":245},{"style":84},[246],{"type":26,"value":247},"  \"compilerOptions\"",{"type":20,"tag":71,"props":249,"children":250},{"style":78},[251],{"type":26,"value":252},": {\n",{"type":20,"tag":71,"props":254,"children":256},{"class":73,"line":255},3,[257,262,266],{"type":20,"tag":71,"props":258,"children":259},{"style":84},[260],{"type":26,"value":261},"    \"target\"",{"type":20,"tag":71,"props":263,"children":264},{"style":78},[265],{"type":26,"value":92},{"type":20,"tag":71,"props":267,"children":268},{"style":95},[269],{"type":26,"value":270},"\"es2020\"\n",{"type":20,"tag":71,"props":272,"children":274},{"class":73,"line":273},4,[275],{"type":20,"tag":71,"props":276,"children":277},{"style":78},[278],{"type":26,"value":279},"  }\n",{"type":20,"tag":71,"props":281,"children":283},{"class":73,"line":282},5,[284],{"type":20,"tag":71,"props":285,"children":286},{"style":78},[287],{"type":26,"value":122},{"type":20,"tag":34,"props":289,"children":290},{"id":125},[291],{"type":26,"value":125},{"type":20,"tag":129,"props":293,"children":294},{},[295,302],{"type":20,"tag":133,"props":296,"children":297},{},[298],{"type":20,"tag":137,"props":299,"children":300},{"href":139},[301],{"type":26,"value":139},{"type":20,"tag":133,"props":303,"children":304},{},[305],{"type":20,"tag":137,"props":306,"children":307},{"href":147},[308],{"type":26,"value":147},{"type":20,"tag":34,"props":310,"children":311},{"id":152},[312],{"type":26,"value":152},{"type":20,"tag":28,"props":314,"children":315},{},[316],{"type":26,"value":317},"JSON 常用作配置文件，但不支持注释，可考虑 JSON5 或 JSONC 替代。 JSONDog 提供全套 JSON 在线工具，纯前端、零上传、中英双语，欢迎免费使用。",{"type":20,"tag":161,"props":319,"children":320},{},[321],{"type":26,"value":165},{"title":7,"searchDepth":167,"depth":167,"links":323},[324,325,326,327,328],{"id":203,"depth":167,"text":203},{"id":213,"depth":167,"text":213},{"id":56,"depth":167,"text":56},{"id":125,"depth":167,"text":125},{"id":152,"depth":167,"text":152},"content:blog:json-as-config.md","blog/json-as-config.md","blog/json-as-config",{"_path":333,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":334,"description":335,"date":10,"category":11,"keywords":336,"body":340,"_type":174,"_id":468,"_source":176,"_file":469,"_stem":470,"_extension":179},"/blog/json-caching","JSON 缓存策略","JSON 响应可缓存于 CDN、Redis、本地，本文介绍缓存键设计与失效策略。",[337,338,339],"json缓存","api缓存","redis json",{"type":17,"children":341,"toc":461},[342,347,352,357,362,367,372,376,426,430,448,452,457],{"type":20,"tag":21,"props":343,"children":345},{"id":344},"json-缓存策略",[346],{"type":26,"value":334},{"type":20,"tag":28,"props":348,"children":349},{},[350],{"type":26,"value":351},"JSON 响应缓存可大幅提升性能，需合理设计缓存键与失效策略。",{"type":20,"tag":34,"props":353,"children":355},{"id":354},"缓存层",[356],{"type":26,"value":354},{"type":20,"tag":28,"props":358,"children":359},{},[360],{"type":26,"value":361},"CDN 缓存静态 JSON、Redis 缓存热点接口、浏览器缓存带 ETag。",{"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},"TTL 过期、版本号键、主动清除，注意一致性。",{"type":20,"tag":34,"props":373,"children":374},{"id":56},[375],{"type":26,"value":56},{"type":20,"tag":60,"props":377,"children":379},{"className":62,"code":378,"language":64,"meta":7,"style":7},"{\"key\": \"user:1:profile\", \"ttl\": 3600}\n",[380],{"type":20,"tag":67,"props":381,"children":382},{"__ignoreMap":7},[383],{"type":20,"tag":71,"props":384,"children":385},{"class":73,"line":74},[386,390,395,399,404,408,413,417,422],{"type":20,"tag":71,"props":387,"children":388},{"style":78},[389],{"type":26,"value":81},{"type":20,"tag":71,"props":391,"children":392},{"style":84},[393],{"type":26,"value":394},"\"key\"",{"type":20,"tag":71,"props":396,"children":397},{"style":78},[398],{"type":26,"value":92},{"type":20,"tag":71,"props":400,"children":401},{"style":95},[402],{"type":26,"value":403},"\"user:1:profile\"",{"type":20,"tag":71,"props":405,"children":406},{"style":78},[407],{"type":26,"value":103},{"type":20,"tag":71,"props":409,"children":410},{"style":84},[411],{"type":26,"value":412},"\"ttl\"",{"type":20,"tag":71,"props":414,"children":415},{"style":78},[416],{"type":26,"value":92},{"type":20,"tag":71,"props":418,"children":419},{"style":84},[420],{"type":26,"value":421},"3600",{"type":20,"tag":71,"props":423,"children":424},{"style":78},[425],{"type":26,"value":122},{"type":20,"tag":34,"props":427,"children":428},{"id":125},[429],{"type":26,"value":125},{"type":20,"tag":129,"props":431,"children":432},{},[433,441],{"type":20,"tag":133,"props":434,"children":435},{},[436],{"type":20,"tag":137,"props":437,"children":439},{"href":438},"/minify",[440],{"type":26,"value":438},{"type":20,"tag":133,"props":442,"children":443},{},[444],{"type":20,"tag":137,"props":445,"children":446},{"href":139},[447],{"type":26,"value":139},{"type":20,"tag":34,"props":449,"children":450},{"id":152},[451],{"type":26,"value":152},{"type":20,"tag":28,"props":453,"children":454},{},[455],{"type":26,"value":456},"JSON 响应可缓存于 CDN、Redis、本地，本文介绍缓存键设计与失效策略。 JSONDog 提供全套 JSON 在线工具，纯前端、零上传、中英双语，欢迎免费使用。",{"type":20,"tag":161,"props":458,"children":459},{},[460],{"type":26,"value":165},{"title":7,"searchDepth":167,"depth":167,"links":462},[463,464,465,466,467],{"id":354,"depth":167,"text":354},{"id":364,"depth":167,"text":364},{"id":56,"depth":167,"text":56},{"id":125,"depth":167,"text":125},{"id":152,"depth":167,"text":152},"content:blog:json-caching.md","blog/json-caching.md","blog/json-caching",{"_path":472,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":473,"description":474,"date":10,"category":11,"keywords":475,"body":479,"_type":174,"_id":633,"_source":176,"_file":634,"_stem":635,"_extension":179},"/blog/json-form-data","JSON 与表单数据转换","前端表单常需与 JSON 互转，本文介绍序列化、嵌套表单与提交技巧。",[476,477,478],"json表单","form json","表单序列化",{"type":17,"children":480,"toc":626},[481,486,491,496,506,511,516,520,591,595,613,617,622],{"type":20,"tag":21,"props":482,"children":484},{"id":483},"json-与表单数据转换",[485],{"type":26,"value":473},{"type":20,"tag":28,"props":487,"children":488},{},[489],{"type":26,"value":490},"前端表单数据常需转为 JSON 提交 API，或将 JSON 回填表单，需处理嵌套与数组。",{"type":20,"tag":34,"props":492,"children":494},{"id":493},"转换方式",[495],{"type":26,"value":493},{"type":20,"tag":28,"props":497,"children":498},{},[499,501,504],{"type":26,"value":500},"FormData 遍历构建对象、name 用点路径表达嵌套、数组用 ",{"type":20,"tag":71,"props":502,"children":503},{},[],{"type":26,"value":505}," 后缀。",{"type":20,"tag":34,"props":507,"children":509},{"id":508},"库推荐",[510],{"type":26,"value":508},{"type":20,"tag":28,"props":512,"children":513},{},[514],{"type":26,"value":515},"qs、form-serialize、或框架内置（如 Vue v-model）。",{"type":20,"tag":34,"props":517,"children":518},{"id":56},[519],{"type":26,"value":56},{"type":20,"tag":60,"props":521,"children":523},{"className":62,"code":522,"language":64,"meta":7,"style":7},"{\"user\": {\"name\": \"x\", \"tags\": [\"a\", \"b\"]}}\n",[524],{"type":20,"tag":67,"props":525,"children":526},{"__ignoreMap":7},[527],{"type":20,"tag":71,"props":528,"children":529},{"class":73,"line":74},[530,534,539,544,549,553,558,562,567,572,577,581,586],{"type":20,"tag":71,"props":531,"children":532},{"style":78},[533],{"type":26,"value":81},{"type":20,"tag":71,"props":535,"children":536},{"style":84},[537],{"type":26,"value":538},"\"user\"",{"type":20,"tag":71,"props":540,"children":541},{"style":78},[542],{"type":26,"value":543},": {",{"type":20,"tag":71,"props":545,"children":546},{"style":84},[547],{"type":26,"value":548},"\"name\"",{"type":20,"tag":71,"props":550,"children":551},{"style":78},[552],{"type":26,"value":92},{"type":20,"tag":71,"props":554,"children":555},{"style":95},[556],{"type":26,"value":557},"\"x\"",{"type":20,"tag":71,"props":559,"children":560},{"style":78},[561],{"type":26,"value":103},{"type":20,"tag":71,"props":563,"children":564},{"style":84},[565],{"type":26,"value":566},"\"tags\"",{"type":20,"tag":71,"props":568,"children":569},{"style":78},[570],{"type":26,"value":571},": [",{"type":20,"tag":71,"props":573,"children":574},{"style":95},[575],{"type":26,"value":576},"\"a\"",{"type":20,"tag":71,"props":578,"children":579},{"style":78},[580],{"type":26,"value":103},{"type":20,"tag":71,"props":582,"children":583},{"style":95},[584],{"type":26,"value":585},"\"b\"",{"type":20,"tag":71,"props":587,"children":588},{"style":78},[589],{"type":26,"value":590},"]}}\n",{"type":20,"tag":34,"props":592,"children":593},{"id":125},[594],{"type":26,"value":125},{"type":20,"tag":129,"props":596,"children":597},{},[598,606],{"type":20,"tag":133,"props":599,"children":600},{},[601],{"type":20,"tag":137,"props":602,"children":604},{"href":603},"/flatten",[605],{"type":26,"value":603},{"type":20,"tag":133,"props":607,"children":608},{},[609],{"type":20,"tag":137,"props":610,"children":611},{"href":139},[612],{"type":26,"value":139},{"type":20,"tag":34,"props":614,"children":615},{"id":152},[616],{"type":26,"value":152},{"type":20,"tag":28,"props":618,"children":619},{},[620],{"type":26,"value":621},"前端表单常需与 JSON 互转，本文介绍序列化、嵌套表单与提交技巧。 JSONDog 提供全套 JSON 在线工具，纯前端、零上传、中英双语，欢迎免费使用。",{"type":20,"tag":161,"props":623,"children":624},{},[625],{"type":26,"value":165},{"title":7,"searchDepth":167,"depth":167,"links":627},[628,629,630,631,632],{"id":493,"depth":167,"text":493},{"id":508,"depth":167,"text":508},{"id":56,"depth":167,"text":56},{"id":125,"depth":167,"text":125},{"id":152,"depth":167,"text":152},"content:blog:json-form-data.md","blog/json-form-data.md","blog/json-form-data",{"_path":637,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":638,"description":639,"date":10,"category":11,"keywords":640,"body":644,"_type":174,"_id":799,"_source":176,"_file":800,"_stem":801,"_extension":179},"/blog/json-in-api","JSON 在 API 中的应用","RESTful 与 GraphQL API 普遍用 JSON 作为请求响应格式，本文介绍最佳实践。",[641,642,643],"json api","restful json","api响应",{"type":17,"children":645,"toc":792},[646,651,656,661,666,671,676,680,758,762,779,783,788],{"type":20,"tag":21,"props":647,"children":649},{"id":648},"json-在-api-中的应用",[650],{"type":26,"value":638},{"type":20,"tag":28,"props":652,"children":653},{},[654],{"type":26,"value":655},"JSON 是当今 Web API 事实标准格式，RESTful 与 GraphQL 均广泛采用。",{"type":20,"tag":34,"props":657,"children":659},{"id":658},"响应设计",[660],{"type":26,"value":658},{"type":20,"tag":28,"props":662,"children":663},{},[664],{"type":26,"value":665},"统一状态码与错误结构、合理分页、字段命名一致、避免过深嵌套。",{"type":20,"tag":34,"props":667,"children":669},{"id":668},"最佳实践",[670],{"type":26,"value":668},{"type":20,"tag":28,"props":672,"children":673},{},[674],{"type":26,"value":675},"用 HTTPS、压缩响应、版本化、文档化字段含义。",{"type":20,"tag":34,"props":677,"children":678},{"id":56},[679],{"type":26,"value":56},{"type":20,"tag":60,"props":681,"children":683},{"className":62,"code":682,"language":64,"meta":7,"style":7},"{\"code\": 0, \"data\": {\"id\": 1}, \"message\": \"ok\"}\n",[684],{"type":20,"tag":67,"props":685,"children":686},{"__ignoreMap":7},[687],{"type":20,"tag":71,"props":688,"children":689},{"class":73,"line":74},[690,694,699,703,708,712,717,721,726,730,735,740,745,749,754],{"type":20,"tag":71,"props":691,"children":692},{"style":78},[693],{"type":26,"value":81},{"type":20,"tag":71,"props":695,"children":696},{"style":84},[697],{"type":26,"value":698},"\"code\"",{"type":20,"tag":71,"props":700,"children":701},{"style":78},[702],{"type":26,"value":92},{"type":20,"tag":71,"props":704,"children":705},{"style":84},[706],{"type":26,"value":707},"0",{"type":20,"tag":71,"props":709,"children":710},{"style":78},[711],{"type":26,"value":103},{"type":20,"tag":71,"props":713,"children":714},{"style":84},[715],{"type":26,"value":716},"\"data\"",{"type":20,"tag":71,"props":718,"children":719},{"style":78},[720],{"type":26,"value":543},{"type":20,"tag":71,"props":722,"children":723},{"style":84},[724],{"type":26,"value":725},"\"id\"",{"type":20,"tag":71,"props":727,"children":728},{"style":78},[729],{"type":26,"value":92},{"type":20,"tag":71,"props":731,"children":732},{"style":84},[733],{"type":26,"value":734},"1",{"type":20,"tag":71,"props":736,"children":737},{"style":78},[738],{"type":26,"value":739},"}, ",{"type":20,"tag":71,"props":741,"children":742},{"style":84},[743],{"type":26,"value":744},"\"message\"",{"type":20,"tag":71,"props":746,"children":747},{"style":78},[748],{"type":26,"value":92},{"type":20,"tag":71,"props":750,"children":751},{"style":95},[752],{"type":26,"value":753},"\"ok\"",{"type":20,"tag":71,"props":755,"children":756},{"style":78},[757],{"type":26,"value":122},{"type":20,"tag":34,"props":759,"children":760},{"id":125},[761],{"type":26,"value":125},{"type":20,"tag":129,"props":763,"children":764},{},[765,772],{"type":20,"tag":133,"props":766,"children":767},{},[768],{"type":20,"tag":137,"props":769,"children":770},{"href":139},[771],{"type":26,"value":139},{"type":20,"tag":133,"props":773,"children":774},{},[775],{"type":20,"tag":137,"props":776,"children":777},{"href":147},[778],{"type":26,"value":147},{"type":20,"tag":34,"props":780,"children":781},{"id":152},[782],{"type":26,"value":152},{"type":20,"tag":28,"props":784,"children":785},{},[786],{"type":26,"value":787},"RESTful 与 GraphQL API 普遍用 JSON 作为请求响应格式，本文介绍最佳实践。 JSONDog 提供全套 JSON 在线工具，纯前端、零上传、中英双语，欢迎免费使用。",{"type":20,"tag":161,"props":789,"children":790},{},[791],{"type":26,"value":165},{"title":7,"searchDepth":167,"depth":167,"links":793},[794,795,796,797,798],{"id":658,"depth":167,"text":658},{"id":668,"depth":167,"text":668},{"id":56,"depth":167,"text":56},{"id":125,"depth":167,"text":125},{"id":152,"depth":167,"text":152},"content:blog:json-in-api.md","blog/json-in-api.md","blog/json-in-api",1787305466797]