[{"data":1,"prerenderedAt":806},["ShallowReactive",2],{"post-/blog/json-to-java-tutorial":3,"related-/blog/json-to-java-tutorial":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-to-java-tutorial","blog",false,"","JSON 转 Java POJO 教程","根据 JSON 生成 Java POJO 类，含字段、getter/setter，用于快速建模。","2026-08-19","工具",[13,14,15],"json转java","json to pojo","json to java class",{"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-转-java-pojo-教程",[25],{"type":26,"value":8},"text",{"type":20,"tag":28,"props":29,"children":30},"p",{},[31],{"type":26,"value":32},"根据 JSON 生成 Java POJO 类，自动推断字段类型并生成属性、构造器等，加速后端建模。",{"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},"string→String、number→Long/Double、boolean→Boolean、array→List、object→嵌套类。",{"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},"可选包名、是否生成 getter/setter、Lombok 注解等。",{"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","{\"id\": 1, \"name\": \"x\", \"price\": 9.9}\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,103,108,112,118,122,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},"\"id\"",{"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},", ",{"type":20,"tag":71,"props":104,"children":105},{"style":84},[106],{"type":26,"value":107},"\"name\"",{"type":20,"tag":71,"props":109,"children":110},{"style":78},[111],{"type":26,"value":92},{"type":20,"tag":71,"props":113,"children":115},{"style":114},"--shiki-default:#9ECBFF",[116],{"type":26,"value":117},"\"x\"",{"type":20,"tag":71,"props":119,"children":120},{"style":78},[121],{"type":26,"value":102},{"type":20,"tag":71,"props":123,"children":124},{"style":84},[125],{"type":26,"value":126},"\"price\"",{"type":20,"tag":71,"props":128,"children":129},{"style":78},[130],{"type":26,"value":92},{"type":20,"tag":71,"props":132,"children":133},{"style":84},[134],{"type":26,"value":135},"9.9",{"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},"/codegen/java",[159],{"type":26,"value":157},{"type":20,"tag":151,"props":161,"children":162},{},[163],{"type":20,"tag":155,"props":164,"children":166},{"href":165},"/format",[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 生成 Java POJO 类，含字段、getter/setter，用于快速建模。 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-to-java-tutorial.md","content","blog/json-to-java-tutorial.md","blog/json-to-java-tutorial","md",[199,350,521,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":347,"_source":194,"_file":348,"_stem":349,"_extension":197},"/blog/how-to-format-json","如何格式化 JSON：美化与缩进","JSON 格式化（美化）是为 JSON 添加缩进与换行，提升可读性。本文介绍在线格式化方法。",[204,205,206],"json格式化","json美化","format json",{"type":17,"children":208,"toc":340},[209,214,219,224,229,234,239,243,305,309,327,331,336],{"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,271,276,281,286,291,295,300],{"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":97},{"type":20,"tag":71,"props":272,"children":273},{"style":78},[274],{"type":26,"value":275},",",{"type":20,"tag":71,"props":277,"children":278},{"style":84},[279],{"type":26,"value":280},"\"b\"",{"type":20,"tag":71,"props":282,"children":283},{"style":78},[284],{"type":26,"value":285},":{",{"type":20,"tag":71,"props":287,"children":288},{"style":84},[289],{"type":26,"value":290},"\"c\"",{"type":20,"tag":71,"props":292,"children":293},{"style":78},[294],{"type":26,"value":266},{"type":20,"tag":71,"props":296,"children":297},{"style":84},[298],{"type":26,"value":299},"2",{"type":20,"tag":71,"props":301,"children":302},{"style":78},[303],{"type":26,"value":304},"}}\n",{"type":20,"tag":34,"props":306,"children":307},{"id":143},[308],{"type":26,"value":143},{"type":20,"tag":147,"props":310,"children":311},{},[312,319],{"type":20,"tag":151,"props":313,"children":314},{},[315],{"type":20,"tag":155,"props":316,"children":317},{"href":165},[318],{"type":26,"value":165},{"type":20,"tag":151,"props":320,"children":321},{},[322],{"type":20,"tag":155,"props":323,"children":325},{"href":324},"/minify",[326],{"type":26,"value":324},{"type":20,"tag":34,"props":328,"children":329},{"id":170},[330],{"type":26,"value":170},{"type":20,"tag":28,"props":332,"children":333},{},[334],{"type":26,"value":335},"JSON 格式化（美化）是为 JSON 添加缩进与换行，提升可读性。本文介绍在线格式化方法。 JSONDog 提供全套 JSON 在线工具，纯前端、零上传、中英双语，欢迎免费使用。",{"type":20,"tag":179,"props":337,"children":338},{},[339],{"type":26,"value":183},{"title":7,"searchDepth":185,"depth":185,"links":341},[342,343,344,345,346],{"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":351,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":352,"description":353,"date":10,"category":11,"keywords":354,"body":358,"_type":192,"_id":518,"_source":194,"_file":519,"_stem":520,"_extension":197},"/blog/how-to-minify-json","如何压缩 JSON：Minify","JSON 压缩去除所有空白与换行，减小体积，用于生产环境传输。",[355,356,357],"json压缩","json minify","compress json",{"type":17,"children":359,"toc":511},[360,365,370,375,380,385,390,394,477,481,498,502,507],{"type":20,"tag":21,"props":361,"children":363},{"id":362},"如何压缩-jsonminify",[364],{"type":26,"value":352},{"type":20,"tag":28,"props":366,"children":367},{},[368],{"type":26,"value":369},"JSON 压缩（minify）去除所有不必要的空白、换行与缩进，将 JSON 压成单行，减小传输体积。",{"type":20,"tag":34,"props":371,"children":373},{"id":372},"压缩好处",[374],{"type":26,"value":372},{"type":20,"tag":28,"props":376,"children":377},{},[378],{"type":26,"value":379},"减小文件体积，加快网络传输，节省存储空间，适合生产环境。",{"type":20,"tag":34,"props":381,"children":383},{"id":382},"开发建议",[384],{"type":26,"value":382},{"type":20,"tag":28,"props":386,"children":387},{},[388],{"type":26,"value":389},"开发时用格式化便于阅读，部署时用压缩优化性能。",{"type":20,"tag":34,"props":391,"children":392},{"id":56},[393],{"type":26,"value":56},{"type":20,"tag":60,"props":395,"children":397},{"className":62,"code":396,"language":64,"meta":7,"style":7},"{\"a\":1,\"b\":[2,3],\"c\":{\"d\":4}}\n",[398],{"type":20,"tag":67,"props":399,"children":400},{"__ignoreMap":7},[401],{"type":20,"tag":71,"props":402,"children":403},{"class":73,"line":74},[404,408,412,416,420,424,428,433,437,441,446,451,455,459,464,468,473],{"type":20,"tag":71,"props":405,"children":406},{"style":78},[407],{"type":26,"value":81},{"type":20,"tag":71,"props":409,"children":410},{"style":84},[411],{"type":26,"value":261},{"type":20,"tag":71,"props":413,"children":414},{"style":78},[415],{"type":26,"value":266},{"type":20,"tag":71,"props":417,"children":418},{"style":84},[419],{"type":26,"value":97},{"type":20,"tag":71,"props":421,"children":422},{"style":78},[423],{"type":26,"value":275},{"type":20,"tag":71,"props":425,"children":426},{"style":84},[427],{"type":26,"value":280},{"type":20,"tag":71,"props":429,"children":430},{"style":78},[431],{"type":26,"value":432},":[",{"type":20,"tag":71,"props":434,"children":435},{"style":84},[436],{"type":26,"value":299},{"type":20,"tag":71,"props":438,"children":439},{"style":78},[440],{"type":26,"value":275},{"type":20,"tag":71,"props":442,"children":443},{"style":84},[444],{"type":26,"value":445},"3",{"type":20,"tag":71,"props":447,"children":448},{"style":78},[449],{"type":26,"value":450},"],",{"type":20,"tag":71,"props":452,"children":453},{"style":84},[454],{"type":26,"value":290},{"type":20,"tag":71,"props":456,"children":457},{"style":78},[458],{"type":26,"value":285},{"type":20,"tag":71,"props":460,"children":461},{"style":84},[462],{"type":26,"value":463},"\"d\"",{"type":20,"tag":71,"props":465,"children":466},{"style":78},[467],{"type":26,"value":266},{"type":20,"tag":71,"props":469,"children":470},{"style":84},[471],{"type":26,"value":472},"4",{"type":20,"tag":71,"props":474,"children":475},{"style":78},[476],{"type":26,"value":304},{"type":20,"tag":34,"props":478,"children":479},{"id":143},[480],{"type":26,"value":143},{"type":20,"tag":147,"props":482,"children":483},{},[484,491],{"type":20,"tag":151,"props":485,"children":486},{},[487],{"type":20,"tag":155,"props":488,"children":489},{"href":324},[490],{"type":26,"value":324},{"type":20,"tag":151,"props":492,"children":493},{},[494],{"type":20,"tag":155,"props":495,"children":496},{"href":165},[497],{"type":26,"value":165},{"type":20,"tag":34,"props":499,"children":500},{"id":170},[501],{"type":26,"value":170},{"type":20,"tag":28,"props":503,"children":504},{},[505],{"type":26,"value":506},"JSON 压缩去除所有空白与换行，减小体积，用于生产环境传输。 JSONDog 提供全套 JSON 在线工具，纯前端、零上传、中英双语，欢迎免费使用。",{"type":20,"tag":179,"props":508,"children":509},{},[510],{"type":26,"value":183},{"title":7,"searchDepth":185,"depth":185,"links":512},[513,514,515,516,517],{"id":372,"depth":185,"text":372},{"id":382,"depth":185,"text":382},{"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":522,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":523,"description":524,"date":10,"category":11,"keywords":525,"body":529,"_type":192,"_id":635,"_source":194,"_file":636,"_stem":637,"_extension":197},"/blog/how-to-validate-json","如何校验 JSON 语法","JSON 校验检查语法是否合法，定位错误行号并给出修复建议。",[526,527,528],"json校验","json验证","validate json",{"type":17,"children":530,"toc":628},[531,536,541,546,551,556,561,565,593,597,615,619,624],{"type":20,"tag":21,"props":532,"children":534},{"id":533},"如何校验-json-语法",[535],{"type":26,"value":523},{"type":20,"tag":28,"props":537,"children":538},{},[539],{"type":26,"value":540},"JSON 校验用于检查 JSON 文本是否符合语法规范，发现错误并定位到具体行列。",{"type":20,"tag":34,"props":542,"children":544},{"id":543},"常见错误",[545],{"type":26,"value":543},{"type":20,"tag":28,"props":547,"children":548},{},[549],{"type":26,"value":550},"单引号、尾逗号、缺引号、缺逗号是高频错误，校验工具会指出位置与原因。",{"type":20,"tag":34,"props":552,"children":554},{"id":553},"校验工具",[555],{"type":26,"value":553},{"type":20,"tag":28,"props":557,"children":558},{},[559],{"type":26,"value":560},"粘贴 JSON 即时校验，合法显示美化预览，非法显示错误行号与修复建议。",{"type":20,"tag":34,"props":562,"children":563},{"id":56},[564],{"type":26,"value":56},{"type":20,"tag":60,"props":566,"children":568},{"className":62,"code":567,"language":64,"meta":7,"style":7},"{\"bad\": \"missing quote}\n",[569],{"type":20,"tag":67,"props":570,"children":571},{"__ignoreMap":7},[572],{"type":20,"tag":71,"props":573,"children":574},{"class":73,"line":74},[575,579,584,588],{"type":20,"tag":71,"props":576,"children":577},{"style":78},[578],{"type":26,"value":81},{"type":20,"tag":71,"props":580,"children":581},{"style":84},[582],{"type":26,"value":583},"\"bad\"",{"type":20,"tag":71,"props":585,"children":586},{"style":78},[587],{"type":26,"value":92},{"type":20,"tag":71,"props":589,"children":590},{"style":114},[591],{"type":26,"value":592},"\"missing quote}\n",{"type":20,"tag":34,"props":594,"children":595},{"id":143},[596],{"type":26,"value":143},{"type":20,"tag":147,"props":598,"children":599},{},[600,608],{"type":20,"tag":151,"props":601,"children":602},{},[603],{"type":20,"tag":155,"props":604,"children":606},{"href":605},"/validate",[607],{"type":26,"value":605},{"type":20,"tag":151,"props":609,"children":610},{},[611],{"type":20,"tag":155,"props":612,"children":613},{"href":165},[614],{"type":26,"value":165},{"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":543,"depth":185,"text":543},{"id":553,"depth":185,"text":553},{"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,673,678,682,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":671},{"id":670},"使用场景",[672],{"type":26,"value":670},{"type":20,"tag":28,"props":674,"children":675},{},[676],{"type":26,"value":677},"对比 API 两次返回、排查配置变更、版本差异分析。",{"type":20,"tag":34,"props":679,"children":680},{"id":56},[681],{"type":26,"value":56},{"type":20,"tag":60,"props":683,"children":685},{"className":62,"code":684,"language":64,"meta":7,"style":7},"{\"a\":1,\"b\":2} vs {\"a\":1,\"c\":3}\n",[686],{"type":20,"tag":67,"props":687,"children":688},{"__ignoreMap":7},[689],{"type":20,"tag":71,"props":690,"children":691},{"class":73,"line":74},[692,696,700,704,708,712,716,720,724,729,733,737,741,745,749,753,757],{"type":20,"tag":71,"props":693,"children":694},{"style":78},[695],{"type":26,"value":81},{"type":20,"tag":71,"props":697,"children":698},{"style":84},[699],{"type":26,"value":261},{"type":20,"tag":71,"props":701,"children":702},{"style":78},[703],{"type":26,"value":266},{"type":20,"tag":71,"props":705,"children":706},{"style":84},[707],{"type":26,"value":97},{"type":20,"tag":71,"props":709,"children":710},{"style":78},[711],{"type":26,"value":275},{"type":20,"tag":71,"props":713,"children":714},{"style":84},[715],{"type":26,"value":280},{"type":20,"tag":71,"props":717,"children":718},{"style":78},[719],{"type":26,"value":266},{"type":20,"tag":71,"props":721,"children":722},{"style":84},[723],{"type":26,"value":299},{"type":20,"tag":71,"props":725,"children":726},{"style":78},[727],{"type":26,"value":728},"} vs {",{"type":20,"tag":71,"props":730,"children":731},{"style":84},[732],{"type":26,"value":261},{"type":20,"tag":71,"props":734,"children":735},{"style":78},[736],{"type":26,"value":266},{"type":20,"tag":71,"props":738,"children":739},{"style":84},[740],{"type":26,"value":97},{"type":20,"tag":71,"props":742,"children":743},{"style":78},[744],{"type":26,"value":275},{"type":20,"tag":71,"props":746,"children":747},{"style":84},[748],{"type":26,"value":290},{"type":20,"tag":71,"props":750,"children":751},{"style":78},[752],{"type":26,"value":266},{"type":20,"tag":71,"props":754,"children":755},{"style":84},[756],{"type":26,"value":445},{"type":20,"tag":71,"props":758,"children":759},{"style":78},[760],{"type":26,"value":140},{"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":165},[782],{"type":26,"value":165},{"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":670,"depth":185,"text":670},{"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",1787305467402]