######递归方式 解析任意深度的json数组(转为自己需要的简化格式json)》再:json数组转javabeanList
程序员文章站
2022-07-15 13:09:45
...
=====目前只能用:简单格式:
[ { "firstName":"John" , "lastName":"Doe" }, { "firstName":"Anna" , "lastName":"Smith" }, { "firstName":"Peter" , "lastName":"Jones" } ]
),复杂格式:
【json有一个key重复:】
=======复杂格式json串:【######自关联格式的json数组如何转为beanList??研究测试了一番。没有现成的API!!!(这不是我第一次研究这个问题了。下次不要研究了。浪费时间。)
因为children深度不确定。底层肯定要递归遍历。(工具js就是这样实现的。完全可以仿照用java写个工具方法。这里图省事,项目不等人,直接拿到简化格式的JsonStr。)】
[{ id: '90', text: '中国', children: [{ id: '80', text: '华北地区', children: [{ id: '1156110000', text: '北京' // children: [ // { id: '742', text: '昌平区' }, // { id: '743', text: '朝阳区' }, // { id: '744', text: '崇文区' }, // { id: '745', text: '大兴区' }, // { id: '746', text: '东城区' }, // { id: '747', text: '房山区' }, // { id: '748', text: '丰台区' }, // { id: '749', text: '海淀区' }, // { id: '750', text: '怀柔区' }, // { id: '751', text: '门头沟区' }, // { id: '752', text: '密云县' }, // { id: '753', text: '平谷区' }, // { id: '754', text: '石景山区' }, // { id: '755', text: '顺义区' }, // { id: '756', text: '通州区' }, // { id: '757', text: '西城区' }, // { id: '758', text: '宣武区' }, // { id: '759', text: '延庆县' } // ] }, { id: '1156120000', text: '天津' // children: [ // { id: '760', text: '宝坻区' }, // { id: '761', text: '北辰区' }, // { id: '763', text: '东丽区' }, // { id: '765', text: '河北区' }, // { id: '766', text: '河东区' }, // { id: '767', text: '和平区' }, // { id: '768', text: '河西区' }, // { id: '769', text: '红桥区' }, // { id: '770', text: '蓟县' }, // { id: '771', text: '津南区' }, // { id: '772', text: '静海县' }, // { id: '773', text: '南开区' }, // { id: '774', text: '宁河县' }, // { id: '776', text: '武清区' }, // { id: '777', text: '西青区' }, // { id: '900', text: '滨海新区' } // ] }, { id: '1156130000', text: '河北', children: [ { id: '1156130600', text: '保定市' }, { id: '1156130900', text: '沧州市' }, { id: '1156130800', text: '承德市' }, { id: '1156130400', text: '邯郸市' }, { id: '1156131100', text: '衡水市' }, { id: '1156131000', text: '廊坊市' }, { id: '1156130300', text: '秦皇岛市' }, { id: '1156130100', text: '石家庄市' }, { id: '1156130200', text: '唐山市' }, { id: '1156130500', text: '邢台市' }, { id: '1156130700', text: '张家口市' }, { id: '1156139000', text: '省直辖县级行政区划' } ] }, { id: '1156150000', text: '内蒙古', children: [ { id: '1156152900', text: '阿拉善盟' }, { id: '1156150800', text: '巴彦淖尔市' }, { id: '1156150200', text: '包头市' }, { id: '1156150400', text: '赤峰市' }, { id: '1156150600', text: '鄂尔多斯市' }, { id: '1156150100', text: '呼和浩特市' }, { id: '1156150700', text: '呼伦贝尔市' }, { id: '1156150500', text: '通辽市' }, { id: '1156150300', text: '乌海市' }, { id: '1156150900', text: '乌兰察布市' }, { id: '1156152500', text: '锡林郭勒盟' }, { id: '1156152200', text: '兴安盟' } ] }, { id: '1156140000', text: '山西', children: [ { id: '1156140200', text: '大同市' }, { id: '1156140500', text: '晋城市' }, { id: '1156140700', text: '晋中市' }, { id: '1156141000', text: '临汾市' }, { id: '1156141100', text: '吕梁市' }, { id: '1156140600', text: '朔州市' }, { id: '1156140100', text: '太原市' }, { id: '1156140900', text: '忻州市' }, { id: '1156140300', text: '阳泉市' }, { id: '1156140800', text: '运城市' }, { id: '1156140400', text: '长治市' } ] }] }, { id: '81', text: '东北地区', children: [{ id: '1156230000', text: '黑龙江', children: [ { id: '1156230600', text: '大庆市' }, { id: '1156232700', text: '大兴安岭地区' }, { id: '1156230100', text: '哈尔滨市' }, { id: '1156230400', text: '鹤岗市' }, { id: '1156231100', text: '黑河市' }, { id: '1156230300', text: '鸡西市' }, { id: '1156230800', text: '佳木斯市' }, { id: '1156231000', text: '牡丹江市' }, { id: '1156230900', text: '七台河市' }, { id: '1156230200', text: '齐齐哈尔市' }, { id: '1156230500', text: '双鸭山市' }, { id: '1156231200', text: '绥化市' }, { id: '1156230700', text: '伊春市' } ] }, { id: '1156220000', text: '吉林', children: [ { id: '1156220800', text: '白城市' }, { id: '1156220600', text: '白山市' }, { id: '1156220200', text: '吉林市' }, { id: '1156220400', text: '辽源市' }, { id: '1156220300', text: '四平市' }, { id: '1156220700', text: '*市' }, { id: '1156220500', text: '通化市' }, { id: '1156222400', text: '延边朝鲜族自治州' }, { id: '1156220100', text: '长春市' } ] }, { id: '1156210000', text: '辽宁', children: [ { id: '1156210300', text: '鞍山市' }, { id: '1156210500', text: '本溪市' }, { id: '1156211300', text: '朝阳市' }, { id: '1156210200', text: '大连市' }, { id: '1156210600', text: '丹东市' }, { id: '1156210400', text: '抚顺市' }, { id: '1156210900', text: '阜新市' }, { id: '1156211400', text: '葫芦岛市' }, { id: '1156210700', text: '锦州市' }, { id: '1156210100', text: '辽阳市' }, { id: '1156211100', text: '盘锦市' }, { id: '1156211000', text: '沈阳市' }, { id: '1156211200', text: '铁岭市' }, { id: '1156210800', text: '营口市' } ] }] }, { id: '82', text: '华东地区', children: [{ id: '1156310000', text: '上海' // children: [ // { id: '818', text: '宝山区' }, // { id: '819', text: '崇明县' }, // { id: '820', text: '奉贤区' }, // { id: '821', text: '虹口区' }, // { id: '822', text: '黄浦区' }, // { id: '823', text: '嘉定区' }, // { id: '824', text: '金山区' }, // { id: '825', text: '静安区' }, // { id: '826', text: '卢湾区' }, // { id: '827', text: '闵行区' }, // { id: '830', text: '浦东新区' }, // { id: '831', text: '普陀区' }, // { id: '832', text: '青浦区' }, // { id: '833', text: '松江区' }, // { id: '834', text: '徐汇区' }, // { id: '835', text: '杨浦区' }, // { id: '836', text: '闸北区' }, // { id: '837', text: '长宁区' } // ] }, { id: '1156340000', text: '安徽', children: [ { id: '1156340800', text: '安庆市' }, { id: '1156340300', text: '蚌埠市' }, { id: '1156341600', text: '亳州市' }, // { id: '104', text: '巢湖市' }, { id: '1156341700', text: '池州市' }, { id: '1156341100', text: '滁州市' }, { id: '1156341200', text: '阜阳市' }, { id: '1156340100', text: '合肥市' }, { id: '1156340600', text: '淮北市' }, { id: '1156340400', text: '淮南市' }, { id: '1156341000', text: '黄山市' }, { id: '1156341500', text: '六安市' }, { id: '1156340500', text: '马鞍山市' }, { id: '1156340700', text: '铜陵市' }, { id: '1156340200', text: '芜湖市' }, { id: '1156341300', text: '宿州市' }, { id: '1156341800', text: '宣城市' } ] }, { id: '1156350000', text: '福建', children: [ { id: '1156350100', text: '福州市' }, { id: '1156350800', text: '龙岩市' }, { id: '1156350700', text: '南平市' }, { id: '1156350900', text: '宁德市' }, { id: '1156350300', text: '莆田市' }, { id: '1156350500', text: '泉州市' }, { id: '1156350400', text: '三明市' }, { id: '1156350200', text: '厦门市' }, { id: '1156350600', text: '漳州市' } ] }, { id: '1156320000', text: '江苏', children: [ { id: '1156320400', text: '常州市' }, { id: '1156320800', text: '淮安市' }, { id: '1156320700', text: '连云港市' }, { id: '1156320100', text: '南京市' }, { id: '1156320600', text: '南通市' }, { id: '1156320500', text: '苏州市' }, { id: '1156321200', text: '泰州市' }, { id: '1156320200', text: '无锡市' }, { id: '1156321300', text: '宿迁市' }, { id: '1156320300', text: '徐州市' }, { id: '1156320900', text: '盐城市' }, { id: '1156321000', text: '扬州市' }, { id: '1156321100', text: '镇江市' } ] }, { id: '1156360000', text: '江西', children: [ { id: '1156361000', text: '抚州市' }, { id: '1156360700', text: '赣州市' }, { id: '1156360800', text: '吉安市' }, { id: '1156360200', text: '景德镇市' }, { id: '1156360400', text: '九江市' }, { id: '1156360100', text: '南昌市' }, { id: '1156360300', text: '萍乡市' }, { id: '1156361100', text: '上饶市' }, { id: '1156360500', text: '新余市' }, { id: '1156360900', text: '宜春市' }, { id: '1156360600', text: '鹰潭市' } ] }, { id: '1156370000', text: '山东', children: [ { id: '1156371600', text: '滨州市' }, { id: '1156371400', text: '德州市' }, { id: '1156370500', text: '东营市' }, { id: '1156371700', text: '菏泽市' }, { id: '1156370100', text: '济南市' }, { id: '1156370800', text: '济宁市' }, { id: '1156371200', text: '莱芜市' }, { id: '1156371500', text: '聊城市' }, { id: '1156371300', text: '临沂市' }, { id: '1156370200', text: '青岛市' }, { id: '1156371100', text: '日照市' }, { id: '1156370900', text: '泰安市' }, { id: '1156371000', text: '威海市' }, { id: '1156370700', text: '潍坊市' }, { id: '1156370600', text: '烟台市' }, { id: '1156370400', text: '枣庄市' }, { id: '1156370300', text: '淄博市' } ] }, { id: '1156330000', text: '浙江', children: [ { id: '1156330100', text: '杭州市' }, { id: '1156330500', text: '湖州市' }, { id: '1156330400', text: '嘉兴市' }, { id: '1156330700', text: '金华市' }, { id: '1156331100', text: '丽水市' }, { id: '1156330200', text: '宁波市' }, { id: '1156330800', text: '衢州市' }, { id: '1156330600', text: '绍兴市' }, { id: '1156331000', text: '台州市' }, { id: '1156330300', text: '温州市' }, { id: '1156330900', text: '舟山市' } ] }] }, { id: '83', text: '华中地区', children: [{ id: '1156410000', text: '河南', children: [ { id: '1156410500', text: '安阳市' }, { id: '1156410600', text: '鹤壁市' }, { id: '1156410800', text: '焦作市' }, { id: '1156410200', text: '开封市' }, { id: '1156411100', text: '漯河市' }, { id: '1156410300', text: '洛阳市' }, { id: '1156411300', text: '南阳市' }, { id: '1156410400', text: '平顶山市' }, { id: '1156410900', text: '濮阳市' }, { id: '1156411200', text: '三门峡市' }, { id: '1156411400', text: '商丘市' }, { id: '1156410700', text: '新乡市' }, { id: '1156411500', text: '信阳市' }, { id: '1156411000', text: '许昌市' }, { id: '1156410100', text: '郑州市' }, { id: '1156411600', text: '周口市' }, { id: '1156411700', text: '驻马店市' }, { id: '1156419000', text: '省直辖县级行政区划' } ] }, { id: '1156420000', text: '湖北', children: [ { id: '1156420700', text: '鄂州市' }, { id: '1156422800', text: '恩施土家族苗族自治州' }, { id: '1156421100', text: '黄冈市' }, { id: '1156420200', text: '黄石市' }, { id: '1156420800', text: '荆门市' }, { id: '1156421000', text: '荆州市' }, // { id: '311', text: '潜江市' }, // { id: '312', text: '神农架林区' }, { id: '1156420300', text: '十堰市' }, { id: '1156421300', text: '随州市' }, // { id: '315', text: '天门市' }, { id: '1156420100', text: '武汉' }, { id: '1156429000', text: '省直辖县级行政区划' }, { id: '1156421200', text: '咸宁市' }, { id: '1156420600', text: '襄阳市' }, { id: '1156420900', text: '孝感市' }, { id: '1156420500', text: '宜昌市' } ] }, { id: '1156430000', text: '湖南', children: [ { id: '1156430700', text: '常德市' }, { id: '1156431000', text: '郴州市' }, { id: '1156430400', text: '衡阳市' }, { id: '1156431200', text: '怀化市' }, { id: '1156431300', text: '娄底市' }, { id: '1156430500', text: '邵阳市' }, { id: '1156430300', text: '湘潭市' }, { id: '1156431000', text: '湘西土家族苗族自治州' }, { id: '1156430900', text: '益阳市' }, { id: '1156431100', text: '永州市' }, { id: '1156430600', text: '岳阳市' }, { id: '1156430800', text: '张家界市' }, { id: '1156430100', text: '长沙市' }, { id: '1156430200', text: '株洲市' } ] }] }, { id: '84', text: '华南地区', children: [{ id: '1156440000', text: '广东', children: [ { id: '1156445100', text: '潮州市' }, { id: '1156441900', text: '东莞市' }, { id: '1156440600', text: '佛山市' }, { id: '1156440100', text: '广州市' }, { id: '1156441600', text: '河源市' }, { id: '1156441300', text: '惠州市' }, { id: '1156440700', text: '江门市' }, { id: '1156445200', text: '揭阳市' }, { id: '1156440900', text: '茂名市' }, { id: '1156441400', text: '梅州市' }, { id: '1156441800', text: '清远市' }, { id: '1156440500', text: '汕头市' }, { id: '1156441500', text: '汕尾市' }, { id: '1156440200', text: '韶关市' }, { id: '1156440300', text: '深圳市' }, { id: '1156441700', text: '阳江市' }, { id: '1156445300', text: '云浮市' }, { id: '1156440800', text: '湛江市' }, { id: '1156441200', text: '肇庆市' }, { id: '1156442000', text: '中山市' }, { id: '1156440400', text: '珠海市' } ] }, { id: '1156450000', text: '广西', children: [ { id: '1156451000', text: '百色市' }, { id: '1156450500', text: '北海市' }, { id: '1156450600', text: '防城港市' }, { id: '1156450800', text: '贵港市' }, { id: '1156450300', text: '桂林市' }, { id: '1156451200', text: '河池市' }, { id: '1156451100', text: '贺州市' }, { id: '1156451300', text: '来宾市' }, { id: '1156450200', text: '柳州市' }, { id: '1156450100', text: '南宁市' }, { id: '1156450700', text: '钦州市' }, { id: '1156450400', text: '梧州市' }, { id: '1156450900', text: '玉林市' }, { id: '1156451400', text: '崇左市' } ] }, { id: '1156460000', text: '海南', children: [ { id: '1156460400', text: '儋州市' }, // { id: '219', text: '东方市' }, { id: '1156460100', text: '海口市' }, // { id: '221', text: '琼海市' }, { id: '1156460200', text: '三亚市' }, { id: '1156469000', text: '省直辖县级行政区划' } // { id: '867', text: '五指山' }, // { id: '868', text: '万宁' } ] }] }, { id: '85', text: '西南地区', children: [{ id: '1156500000', text: '重庆' // children: [ // { id: '778', text: '巴南区' }, // { id: '779', text: '北碚区' }, // { id: '780', text: '璧山县' }, // { id: '781', text: '城口县' }, // { id: '782', text: '大渡口区' }, // { id: '783', text: '大足县' }, // { id: '784', text: '垫江县' }, // { id: '785', text: '丰都县' }, // { id: '786', text: '奉节县' }, // { id: '787', text: '涪陵区' }, // { id: '788', text: '合川区' }, // { id: '789', text: '江北区' }, // { id: '790', text: '江津区' }, // { id: '791', text: '九龙坡区' }, // { id: '792', text: '开县' }, // { id: '793', text: '梁平县' }, // { id: '794', text: '南岸区' }, // { id: '795', text: '南川区' }, // { id: '796', text: '彭水县' }, // { id: '797', text: '綦江县' }, // { id: '798', text: '黔江区' }, // { id: '799', text: '荣昌县' }, // { id: '800', text: '沙坪坝区' }, // { id: '801', text: '石柱县' }, // { id: '802', text: '双桥区' }, // { id: '803', text: '铜梁县' }, // { id: '804', text: '潼南县' }, // { id: '805', text: '万盛区' }, // { id: '806', text: '万州区' }, // { id: '807', text: '巫山县' }, // { id: '808', text: '巫溪县' }, // { id: '809', text: '武隆县' }, // { id: '810', text: '秀山县' }, // { id: '811', text: '永川区' }, // { id: '812', text: '酉阳县' }, // { id: '813', text: '渝北区' }, // { id: '814', text: '渝中区' }, // { id: '815', text: '云阳县' }, // { id: '816', text: '长寿区' }, // { id: '817', text: '忠县' } // ] }, { id: '1156520000', text: '贵州', children: [ { id: '1156520400', text: '安顺市' }, { id: '1156520500', text: '毕节市' }, { id: '1156520100', text: '贵阳市' }, { id: '1156520200', text: '六盘水市' }, { id: '1156522600', text: '黔东南苗族侗族自治州' }, { id: '1156522700', text: '黔南布依族苗族自治州' }, { id: '1156522300', text: '黔西南布依族苗族自治州' }, { id: '1156520600', text: '铜仁市' }, { id: '1156520300', text: '遵义市' } ] }, { id: '1156510000', text: '四川', children: [ { id: '1156513200', text: '阿坝藏族羌族自治州' }, { id: '1156511900', text: '巴中市' }, { id: '1156510100', text: '成都市' }, { id: '1156511700', text: '达州市' }, { id: '1156510600', text: '德阳市' }, { id: '1156513300', text: '甘孜藏族自治州' }, { id: '1156511600', text: '广安市' }, { id: '1156510800', text: '广元市' }, { id: '1156511100', text: '乐山市' }, { id: '1156513400', text: '凉山彝族自治州' }, { id: '1156510500', text: '泸州市' }, { id: '1156511400', text: '眉山市' }, { id: '1156510700', text: '绵阳市' }, { id: '1156511300', text: '南充市' }, { id: '1156511000', text: '内江市' }, { id: '1156510400', text: '攀枝花市' }, { id: '1156510900', text: '遂宁市' }, { id: '1156511800', text: '雅安市' }, { id: '1156511500', text: '宜宾市' }, { id: '1156512000', text: '资阳市' }, { id: '1156510300', text: '自贡市' } ] }, { id: '1156540000', text: '*', children: [ { id: '1156540100', text: '拉萨市' }, { id: '1156540400', text: '林芝市' }, { id: '1156542400', text: '那曲地区' }, { id: '1156540200', text: '日喀则市' }, { id: '1156540300', text: '昌都市' }, { id: '1156540500', text: '山南市' }, { id: '1156542500', text: '阿里地区' } ] }, { id: '1156530000', text: '云南', children: [ { id: '1156530500', text: '保山市' }, { id: '1156532300', text: '楚雄彝族自治州' }, { id: '1156532900', text: '大理白族自治州' }, { id: '1156533100', text: '德宏傣族景颇族自治州' }, { id: '1156532500', text: '红河哈尼族彝族自治州' }, { id: '1156530100', text: '昆明市' }, { id: '1156530700', text: '丽江市' }, { id: '1156530900', text: '临沧市' }, { id: '1156530800', text: '普洱市' }, { id: '1156530300', text: '曲靖市' }, { id: '1156532600', text: '文山壮族苗族自治州' }, { id: '1156530400', text: '玉溪市' }, { id: '1156530600', text: '昭通市' }, { id: '1156532800', text: '西双版纳傣族自治州' }, { id: '1156533300', text: '怒江傈僳族自治州' }, { id: '1156533400', text: '迪庆藏族自治州' } ] }] }, { id: '86', text: '西北地区', children: [{ id: '1156620000', text: '甘肃', children: [ { id: '1156620400', text: '白银市' }, { id: '1156621100', text: '定西市' }, { id: '1156620200', text: '嘉峪关市' }, { id: '1156620300', text: '金昌市' }, { id: '1156620900', text: '酒泉市' }, { id: '1156620100', text: '兰州市' }, { id: '1156622900', text: '临夏回族自治州' }, { id: '1156621200', text: '陇南市' }, { id: '1156620800', text: '平凉市' }, { id: '1156621000', text: '庆阳市' }, { id: '1156620500', text: '天水市' }, { id: '1156620600', text: '武威市' }, { id: '1156620700', text: '张掖市' }, { id: '1156623000', text: '甘南藏族自治州' } ] }, { id: '1156640000', text: '宁夏', children: [ { id: '1156640400', text: '固原市' }, { id: '1156640200', text: '石嘴山市' }, { id: '1156640300', text: '吴忠市' }, { id: '1156640100', text: '银川市' }, { id: '1156640500', text: '中卫市' } ] }, { id: '1156630000', text: '青海', children: [ { id: '1156630200', text: '海东市' }, { id: '1156632800', text: '海西蒙古族藏族自治州' }, { id: '1156630100', text: '西宁市' }, { id: '1156632700', text: '玉树藏族自治州' }, { id: '1156632200', text: '海北藏族自治州' }, { id: '1156632300', text: '黄南藏族自治州' }, { id: '1156632500', text: '海南藏族自治州' }, { id: '1156632600', text: '果洛藏族自治州' } ] }, { id: '1156610000', text: '陕西', children: [ { id: '1156610900', text: '安康市' }, { id: '1156610300', text: '宝鸡市' }, { id: '1156610700', text: '汉中市' }, { id: '1156611000', text: '商洛市' }, { id: '1156610200', text: '铜川市' }, { id: '1156610500', text: '渭南市' }, { id: '1156610100', text: '西安市' }, { id: '1156610400', text: '咸阳市' }, { id: '1156610600', text: '延安市' }, { id: '1156610800', text: '榆林市' } ] }, { id: '1156650000', text: '*', children: [ { id: '1156652900', text: '阿克苏地区' }, { id: '1156654300', text: '阿勒泰地区' }, { id: '1156652800', text: '巴音郭楞蒙古自治州' }, { id: '1156652700', text: '博尔塔拉蒙古自治州' }, { id: '1156652300', text: '昌吉回族自治州' }, { id: '1156650500', text: '哈密市' }, { id: '1156653200', text: '和田地区' }, { id: '1156653100', text: '喀什地区' }, { id: '1156650200', text: '克拉玛依市' }, // { id: '570', text: '石河子市' }, { id: '1156654200', text: '塔城地区' }, { id: '1156650400', text: '吐鲁番市' }, { id: '1156650100', text: '乌鲁木齐市' }, { id: '1156654000', text: '伊犁哈萨克自治州' }, { id: '1156653000', text: '克孜勒苏柯尔克孜' }, { id: '1156659000', text: '自治区直辖县级行政区划' } ] }] }, { id: '87', text: '港澳台', children: [ { id: '1156669000', text: '澳门' }, { id: '1156667000', text: '香港' }, { id: '1156668000', text: '*' } ] }] }, // { id: '999', text: '国外' }, // { id: '0', text: '其他' } ];
待测。
=====简单格式实现:
package com.ybl.td.util;
import com.alibaba.fastjson.JSON;
import com.ybl.td.ad.creative.bean.ExportRegionDO;
import net.sf.json.JSONArray;
import net.sf.json.JsonConfig;
import java.util.*;
/**
* =======问题:java拼接 json 串。串太复杂了。不会拼。
*/
public class RegionUtil2 {
static String regionAllJsonStr = "[{\"id\":\"90\",\"text\":\"中国\"},{\"id\":\"80\",\"text\":\"华北地区\"},{\"id\":\"1156110000\",\"text\":\"北京\"},{\"id\":\"1156120000\",\"text\":\"天津\"},{\"id\":\"1156130000\",\"text\":\"河北\"},{\"id\":\"1156130600\",\"text\":\"保定市\"},{\"id\":\"1156130900\",\"text\":\"沧州市\"},{\"id\":\"1156130800\",\"text\":\"承德市\"},{\"id\":\"1156130400\",\"text\":\"邯郸市\"},{\"id\":\"1156131100\",\"text\":\"衡水市\"},{\"id\":\"1156131000\",\"text\":\"廊坊市\"},{\"id\":\"1156130300\",\"text\":\"秦皇岛市\"},{\"id\":\"1156130100\",\"text\":\"石家庄市\"},{\"id\":\"1156130200\",\"text\":\"唐山市\"},{\"id\":\"1156130500\",\"text\":\"邢台市\"},{\"id\":\"1156130700\",\"text\":\"张家口市\"},{\"id\":\"1156139000\",\"text\":\"省直辖县级行政区划\"},{\"id\":\"1156150000\",\"text\":\"内蒙古\"},{\"id\":\"1156152900\",\"text\":\"阿拉善盟\"},{\"id\":\"1156150800\",\"text\":\"巴彦淖尔市\"},{\"id\":\"1156150200\",\"text\":\"包头市\"},{\"id\":\"1156150400\",\"text\":\"赤峰市\"},{\"id\":\"1156150600\",\"text\":\"鄂尔多斯市\"},{\"id\":\"1156150100\",\"text\":\"呼和浩特市\"},{\"id\":\"1156150700\",\"text\":\"呼伦贝尔市\"},{\"id\":\"1156150500\",\"text\":\"通辽市\"},{\"id\":\"1156150300\",\"text\":\"乌海市\"},{\"id\":\"1156150900\",\"text\":\"乌兰察布市\"},{\"id\":\"1156152500\",\"text\":\"锡林郭勒盟\"},{\"id\":\"1156152200\",\"text\":\"兴安盟\"},{\"id\":\"1156140000\",\"text\":\"山西\"},{\"id\":\"1156140200\",\"text\":\"大同市\"},{\"id\":\"1156140500\",\"text\":\"晋城市\"},{\"id\":\"1156140700\",\"text\":\"晋中市\"},{\"id\":\"1156141000\",\"text\":\"临汾市\"},{\"id\":\"1156141100\",\"text\":\"吕梁市\"},{\"id\":\"1156140600\",\"text\":\"朔州市\"},{\"id\":\"1156140100\",\"text\":\"太原市\"},{\"id\":\"1156140900\",\"text\":\"忻州市\"},{\"id\":\"1156140300\",\"text\":\"阳泉市\"},{\"id\":\"1156140800\",\"text\":\"运城市\"},{\"id\":\"1156140400\",\"text\":\"长治市\"},{\"id\":\"81\",\"text\":\"东北地区\"},{\"id\":\"1156230000\",\"text\":\"黑龙江\"},{\"id\":\"1156230600\",\"text\":\"大庆市\"},{\"id\":\"1156232700\",\"text\":\"大兴安岭地区\"},{\"id\":\"1156230100\",\"text\":\"哈尔滨市\"},{\"id\":\"1156230400\",\"text\":\"鹤岗市\"},{\"id\":\"1156231100\",\"text\":\"黑河市\"},{\"id\":\"1156230300\",\"text\":\"鸡西市\"},{\"id\":\"1156230800\",\"text\":\"佳木斯市\"},{\"id\":\"1156231000\",\"text\":\"牡丹江市\"},{\"id\":\"1156230900\",\"text\":\"七台河市\"},{\"id\":\"1156230200\",\"text\":\"齐齐哈尔市\"},{\"id\":\"1156230500\",\"text\":\"双鸭山市\"},{\"id\":\"1156231200\",\"text\":\"绥化市\"},{\"id\":\"1156230700\",\"text\":\"伊春市\"},{\"id\":\"1156220000\",\"text\":\"吉林\"},{\"id\":\"1156220800\",\"text\":\"白城市\"},{\"id\":\"1156220600\",\"text\":\"白山市\"},{\"id\":\"1156220200\",\"text\":\"吉林市\"},{\"id\":\"1156220400\",\"text\":\"辽源市\"},{\"id\":\"1156220300\",\"text\":\"四平市\"},{\"id\":\"1156220700\",\"text\":\"*市\"},{\"id\":\"1156220500\",\"text\":\"通化市\"},{\"id\":\"1156222400\",\"text\":\"延边朝鲜族自治州\"},{\"id\":\"1156220100\",\"text\":\"长春市\"},{\"id\":\"1156210000\",\"text\":\"辽宁\"},{\"id\":\"1156210300\",\"text\":\"鞍山市\"},{\"id\":\"1156210500\",\"text\":\"本溪市\"},{\"id\":\"1156211300\",\"text\":\"朝阳市\"},{\"id\":\"1156210200\",\"text\":\"大连市\"},{\"id\":\"1156210600\",\"text\":\"丹东市\"},{\"id\":\"1156210400\",\"text\":\"抚顺市\"},{\"id\":\"1156210900\",\"text\":\"阜新市\"},{\"id\":\"1156211400\",\"text\":\"葫芦岛市\"},{\"id\":\"1156210700\",\"text\":\"锦州市\"},{\"id\":\"1156210100\",\"text\":\"辽阳市\"},{\"id\":\"1156211100\",\"text\":\"盘锦市\"},{\"id\":\"1156211000\",\"text\":\"沈阳市\"},{\"id\":\"1156211200\",\"text\":\"铁岭市\"},{\"id\":\"1156210800\",\"text\":\"营口市\"},{\"id\":\"82\",\"text\":\"华东地区\"},{\"id\":\"1156310000\",\"text\":\"上海\"},{\"id\":\"1156340000\",\"text\":\"安徽\"},{\"id\":\"1156340800\",\"text\":\"安庆市\"},{\"id\":\"1156340300\",\"text\":\"蚌埠市\"},{\"id\":\"1156341600\",\"text\":\"亳州市\"},{\"id\":\"1156341700\",\"text\":\"池州市\"},{\"id\":\"1156341100\",\"text\":\"滁州市\"},{\"id\":\"1156341200\",\"text\":\"阜阳市\"},{\"id\":\"1156340100\",\"text\":\"合肥市\"},{\"id\":\"1156340600\",\"text\":\"淮北市\"},{\"id\":\"1156340400\",\"text\":\"淮南市\"},{\"id\":\"1156341000\",\"text\":\"黄山市\"},{\"id\":\"1156341500\",\"text\":\"六安市\"},{\"id\":\"1156340500\",\"text\":\"马鞍山市\"},{\"id\":\"1156340700\",\"text\":\"铜陵市\"},{\"id\":\"1156340200\",\"text\":\"芜湖市\"},{\"id\":\"1156341300\",\"text\":\"宿州市\"},{\"id\":\"1156341800\",\"text\":\"宣城市\"},{\"id\":\"1156350000\",\"text\":\"福建\"},{\"id\":\"1156350100\",\"text\":\"福州市\"},{\"id\":\"1156350800\",\"text\":\"龙岩市\"},{\"id\":\"1156350700\",\"text\":\"南平市\"},{\"id\":\"1156350900\",\"text\":\"宁德市\"},{\"id\":\"1156350300\",\"text\":\"莆田市\"},{\"id\":\"1156350500\",\"text\":\"泉州市\"},{\"id\":\"1156350400\",\"text\":\"三明市\"},{\"id\":\"1156350200\",\"text\":\"厦门市\"},{\"id\":\"1156350600\",\"text\":\"漳州市\"},{\"id\":\"1156320000\",\"text\":\"江苏\"},{\"id\":\"1156320400\",\"text\":\"常州市\"},{\"id\":\"1156320800\",\"text\":\"淮安市\"},{\"id\":\"1156320700\",\"text\":\"连云港市\"},{\"id\":\"1156320100\",\"text\":\"南京市\"},{\"id\":\"1156320600\",\"text\":\"南通市\"},{\"id\":\"1156320500\",\"text\":\"苏州市\"},{\"id\":\"1156321200\",\"text\":\"泰州市\"},{\"id\":\"1156320200\",\"text\":\"无锡市\"},{\"id\":\"1156321300\",\"text\":\"宿迁市\"},{\"id\":\"1156320300\",\"text\":\"徐州市\"},{\"id\":\"1156320900\",\"text\":\"盐城市\"},{\"id\":\"1156321000\",\"text\":\"扬州市\"},{\"id\":\"1156321100\",\"text\":\"镇江市\"},{\"id\":\"1156360000\",\"text\":\"江西\"},{\"id\":\"1156361000\",\"text\":\"抚州市\"},{\"id\":\"1156360700\",\"text\":\"赣州市\"},{\"id\":\"1156360800\",\"text\":\"吉安市\"},{\"id\":\"1156360200\",\"text\":\"景德镇市\"},{\"id\":\"1156360400\",\"text\":\"九江市\"},{\"id\":\"1156360100\",\"text\":\"南昌市\"},{\"id\":\"1156360300\",\"text\":\"萍乡市\"},{\"id\":\"1156361100\",\"text\":\"上饶市\"},{\"id\":\"1156360500\",\"text\":\"新余市\"},{\"id\":\"1156360900\",\"text\":\"宜春市\"},{\"id\":\"1156360600\",\"text\":\"鹰潭市\"},{\"id\":\"1156370000\",\"text\":\"山东\"},{\"id\":\"1156371600\",\"text\":\"滨州市\"},{\"id\":\"1156371400\",\"text\":\"德州市\"},{\"id\":\"1156370500\",\"text\":\"东营市\"},{\"id\":\"1156371700\",\"text\":\"菏泽市\"},{\"id\":\"1156370100\",\"text\":\"济南市\"},{\"id\":\"1156370800\",\"text\":\"济宁市\"},{\"id\":\"1156371200\",\"text\":\"莱芜市\"},{\"id\":\"1156371500\",\"text\":\"聊城市\"},{\"id\":\"1156371300\",\"text\":\"临沂市\"},{\"id\":\"1156370200\",\"text\":\"青岛市\"},{\"id\":\"1156371100\",\"text\":\"日照市\"},{\"id\":\"1156370900\",\"text\":\"泰安市\"},{\"id\":\"1156371000\",\"text\":\"威海市\"},{\"id\":\"1156370700\",\"text\":\"潍坊市\"},{\"id\":\"1156370600\",\"text\":\"烟台市\"},{\"id\":\"1156370400\",\"text\":\"枣庄市\"},{\"id\":\"1156370300\",\"text\":\"淄博市\"},{\"id\":\"1156330000\",\"text\":\"浙江\"},{\"id\":\"1156330100\",\"text\":\"杭州市\"},{\"id\":\"1156330500\",\"text\":\"湖州市\"},{\"id\":\"1156330400\",\"text\":\"嘉兴市\"},{\"id\":\"1156330700\",\"text\":\"金华市\"},{\"id\":\"1156331100\",\"text\":\"丽水市\"},{\"id\":\"1156330200\",\"text\":\"宁波市\"},{\"id\":\"1156330800\",\"text\":\"衢州市\"},{\"id\":\"1156330600\",\"text\":\"绍兴市\"},{\"id\":\"1156331000\",\"text\":\"台州市\"},{\"id\":\"1156330300\",\"text\":\"温州市\"},{\"id\":\"1156330900\",\"text\":\"舟山市\"},{\"id\":\"83\",\"text\":\"华中地区\"},{\"id\":\"1156410000\",\"text\":\"河南\"},{\"id\":\"1156410500\",\"text\":\"安阳市\"},{\"id\":\"1156410600\",\"text\":\"鹤壁市\"},{\"id\":\"1156410800\",\"text\":\"焦作市\"},{\"id\":\"1156410200\",\"text\":\"开封市\"},{\"id\":\"1156411100\",\"text\":\"漯河市\"},{\"id\":\"1156410300\",\"text\":\"洛阳市\"},{\"id\":\"1156411300\",\"text\":\"南阳市\"},{\"id\":\"1156410400\",\"text\":\"平顶山市\"},{\"id\":\"1156410900\",\"text\":\"濮阳市\"},{\"id\":\"1156411200\",\"text\":\"三门峡市\"},{\"id\":\"1156411400\",\"text\":\"商丘市\"},{\"id\":\"1156410700\",\"text\":\"新乡市\"},{\"id\":\"1156411500\",\"text\":\"信阳市\"},{\"id\":\"1156411000\",\"text\":\"许昌市\"},{\"id\":\"1156410100\",\"text\":\"郑州市\"},{\"id\":\"1156411600\",\"text\":\"周口市\"},{\"id\":\"1156411700\",\"text\":\"驻马店市\"},{\"id\":\"1156419000\",\"text\":\"省直辖县级行政区划\"},{\"id\":\"1156420000\",\"text\":\"湖北\"},{\"id\":\"1156420700\",\"text\":\"鄂州市\"},{\"id\":\"1156422800\",\"text\":\"恩施土家族苗族自治州\"},{\"id\":\"1156421100\",\"text\":\"黄冈市\"},{\"id\":\"1156420200\",\"text\":\"黄石市\"},{\"id\":\"1156420800\",\"text\":\"荆门市\"},{\"id\":\"1156421000\",\"text\":\"荆州市\"},{\"id\":\"1156420300\",\"text\":\"十堰市\"},{\"id\":\"1156421300\",\"text\":\"随州市\"},{\"id\":\"1156420100\",\"text\":\"武汉\"},{\"id\":\"1156429000\",\"text\":\"省直辖县级行政区划\"},{\"id\":\"1156421200\",\"text\":\"咸宁市\"},{\"id\":\"1156420600\",\"text\":\"襄阳市\"},{\"id\":\"1156420900\",\"text\":\"孝感市\"},{\"id\":\"1156420500\",\"text\":\"宜昌市\"},{\"id\":\"1156430000\",\"text\":\"湖南\"},{\"id\":\"1156430700\",\"text\":\"常德市\"},{\"id\":\"1156431000\",\"text\":\"郴州市\"},{\"id\":\"1156430400\",\"text\":\"衡阳市\"},{\"id\":\"1156431200\",\"text\":\"怀化市\"},{\"id\":\"1156431300\",\"text\":\"娄底市\"},{\"id\":\"1156430500\",\"text\":\"邵阳市\"},{\"id\":\"1156430300\",\"text\":\"湘潭市\"},{\"id\":\"1156431000\",\"text\":\"湘西土家族苗族自治州\"},{\"id\":\"1156430900\",\"text\":\"益阳市\"},{\"id\":\"1156431100\",\"text\":\"永州市\"},{\"id\":\"1156430600\",\"text\":\"岳阳市\"},{\"id\":\"1156430800\",\"text\":\"张家界市\"},{\"id\":\"1156430100\",\"text\":\"长沙市\"},{\"id\":\"1156430200\",\"text\":\"株洲市\"},{\"id\":\"84\",\"text\":\"华南地区\"},{\"id\":\"1156440000\",\"text\":\"广东\"},{\"id\":\"1156445100\",\"text\":\"潮州市\"},{\"id\":\"1156441900\",\"text\":\"东莞市\"},{\"id\":\"1156440600\",\"text\":\"佛山市\"},{\"id\":\"1156440100\",\"text\":\"广州市\"},{\"id\":\"1156441600\",\"text\":\"河源市\"},{\"id\":\"1156441300\",\"text\":\"惠州市\"},{\"id\":\"1156440700\",\"text\":\"江门市\"},{\"id\":\"1156445200\",\"text\":\"揭阳市\"},{\"id\":\"1156440900\",\"text\":\"茂名市\"},{\"id\":\"1156441400\",\"text\":\"梅州市\"},{\"id\":\"1156441800\",\"text\":\"清远市\"},{\"id\":\"1156440500\",\"text\":\"汕头市\"},{\"id\":\"1156441500\",\"text\":\"汕尾市\"},{\"id\":\"1156440200\",\"text\":\"韶关市\"},{\"id\":\"1156440300\",\"text\":\"深圳市\"},{\"id\":\"1156441700\",\"text\":\"阳江市\"},{\"id\":\"1156445300\",\"text\":\"云浮市\"},{\"id\":\"1156440800\",\"text\":\"湛江市\"},{\"id\":\"1156441200\",\"text\":\"肇庆市\"},{\"id\":\"1156442000\",\"text\":\"中山市\"},{\"id\":\"1156440400\",\"text\":\"珠海市\"},{\"id\":\"1156450000\",\"text\":\"广西\"},{\"id\":\"1156451000\",\"text\":\"百色市\"},{\"id\":\"1156450500\",\"text\":\"北海市\"},{\"id\":\"1156450600\",\"text\":\"防城港市\"},{\"id\":\"1156450800\",\"text\":\"贵港市\"},{\"id\":\"1156450300\",\"text\":\"桂林市\"},{\"id\":\"1156451200\",\"text\":\"河池市\"},{\"id\":\"1156451100\",\"text\":\"贺州市\"},{\"id\":\"1156451300\",\"text\":\"来宾市\"},{\"id\":\"1156450200\",\"text\":\"柳州市\"},{\"id\":\"1156450100\",\"text\":\"南宁市\"},{\"id\":\"1156450700\",\"text\":\"钦州市\"},{\"id\":\"1156450400\",\"text\":\"梧州市\"},{\"id\":\"1156450900\",\"text\":\"玉林市\"},{\"id\":\"1156451400\",\"text\":\"崇左市\"},{\"id\":\"1156460000\",\"text\":\"海南\"},{\"id\":\"1156460400\",\"text\":\"儋州市\"},{\"id\":\"1156460100\",\"text\":\"海口市\"},{\"id\":\"1156460200\",\"text\":\"三亚市\"},{\"id\":\"1156469000\",\"text\":\"省直辖县级行政区划\"},{\"id\":\"85\",\"text\":\"西南地区\"},{\"id\":\"1156500000\",\"text\":\"重庆\"},{\"id\":\"1156520000\",\"text\":\"贵州\"},{\"id\":\"1156520400\",\"text\":\"安顺市\"},{\"id\":\"1156520500\",\"text\":\"毕节市\"},{\"id\":\"1156520100\",\"text\":\"贵阳市\"},{\"id\":\"1156520200\",\"text\":\"六盘水市\"},{\"id\":\"1156522600\",\"text\":\"黔东南苗族侗族自治州\"},{\"id\":\"1156522700\",\"text\":\"黔南布依族苗族自治州\"},{\"id\":\"1156522300\",\"text\":\"黔西南布依族苗族自治州\"},{\"id\":\"1156520600\",\"text\":\"铜仁市\"},{\"id\":\"1156520300\",\"text\":\"遵义市\"},{\"id\":\"1156510000\",\"text\":\"四川\"},{\"id\":\"1156513200\",\"text\":\"阿坝藏族羌族自治州\"},{\"id\":\"1156511900\",\"text\":\"巴中市\"},{\"id\":\"1156510100\",\"text\":\"成都市\"},{\"id\":\"1156511700\",\"text\":\"达州市\"},{\"id\":\"1156510600\",\"text\":\"德阳市\"},{\"id\":\"1156513300\",\"text\":\"甘孜藏族自治州\"},{\"id\":\"1156511600\",\"text\":\"广安市\"},{\"id\":\"1156510800\",\"text\":\"广元市\"},{\"id\":\"1156511100\",\"text\":\"乐山市\"},{\"id\":\"1156513400\",\"text\":\"凉山彝族自治州\"},{\"id\":\"1156510500\",\"text\":\"泸州市\"},{\"id\":\"1156511400\",\"text\":\"眉山市\"},{\"id\":\"1156510700\",\"text\":\"绵阳市\"},{\"id\":\"1156511300\",\"text\":\"南充市\"},{\"id\":\"1156511000\",\"text\":\"内江市\"},{\"id\":\"1156510400\",\"text\":\"攀枝花市\"},{\"id\":\"1156510900\",\"text\":\"遂宁市\"},{\"id\":\"1156511800\",\"text\":\"雅安市\"},{\"id\":\"1156511500\",\"text\":\"宜宾市\"},{\"id\":\"1156512000\",\"text\":\"资阳市\"},{\"id\":\"1156510300\",\"text\":\"自贡市\"},{\"id\":\"1156540000\",\"text\":\"*\"},{\"id\":\"1156540100\",\"text\":\"拉萨市\"},{\"id\":\"1156540400\",\"text\":\"林芝市\"},{\"id\":\"1156542400\",\"text\":\"那曲地区\"},{\"id\":\"1156540200\",\"text\":\"日喀则市\"},{\"id\":\"1156540300\",\"text\":\"昌都市\"},{\"id\":\"1156540500\",\"text\":\"山南市\"},{\"id\":\"1156542500\",\"text\":\"阿里地区\"},{\"id\":\"1156530000\",\"text\":\"云南\"},{\"id\":\"1156530500\",\"text\":\"保山市\"},{\"id\":\"1156532300\",\"text\":\"楚雄彝族自治州\"},{\"id\":\"1156532900\",\"text\":\"大理白族自治州\"},{\"id\":\"1156533100\",\"text\":\"德宏傣族景颇族自治州\"},{\"id\":\"1156532500\",\"text\":\"红河哈尼族彝族自治州\"},{\"id\":\"1156530100\",\"text\":\"昆明市\"},{\"id\":\"1156530700\",\"text\":\"丽江市\"},{\"id\":\"1156530900\",\"text\":\"临沧市\"},{\"id\":\"1156530800\",\"text\":\"普洱市\"},{\"id\":\"1156530300\",\"text\":\"曲靖市\"},{\"id\":\"1156532600\",\"text\":\"文山壮族苗族自治州\"},{\"id\":\"1156530400\",\"text\":\"玉溪市\"},{\"id\":\"1156530600\",\"text\":\"昭通市\"},{\"id\":\"1156532800\",\"text\":\"西双版纳傣族自治州\"},{\"id\":\"1156533300\",\"text\":\"怒江傈僳族自治州\"},{\"id\":\"1156533400\",\"text\":\"迪庆藏族自治州\"},{\"id\":\"86\",\"text\":\"西北地区\"},{\"id\":\"1156620000\",\"text\":\"甘肃\"},{\"id\":\"1156620400\",\"text\":\"白银市\"},{\"id\":\"1156621100\",\"text\":\"定西市\"},{\"id\":\"1156620200\",\"text\":\"嘉峪关市\"},{\"id\":\"1156620300\",\"text\":\"金昌市\"},{\"id\":\"1156620900\",\"text\":\"酒泉市\"},{\"id\":\"1156620100\",\"text\":\"兰州市\"},{\"id\":\"1156622900\",\"text\":\"临夏回族自治州\"},{\"id\":\"1156621200\",\"text\":\"陇南市\"},{\"id\":\"1156620800\",\"text\":\"平凉市\"},{\"id\":\"1156621000\",\"text\":\"庆阳市\"},{\"id\":\"1156620500\",\"text\":\"天水市\"},{\"id\":\"1156620600\",\"text\":\"武威市\"},{\"id\":\"1156620700\",\"text\":\"张掖市\"},{\"id\":\"1156623000\",\"text\":\"甘南藏族自治州\"},{\"id\":\"1156640000\",\"text\":\"宁夏\"},{\"id\":\"1156640400\",\"text\":\"固原市\"},{\"id\":\"1156640200\",\"text\":\"石嘴山市\"},{\"id\":\"1156640300\",\"text\":\"吴忠市\"},{\"id\":\"1156640100\",\"text\":\"银川市\"},{\"id\":\"1156640500\",\"text\":\"中卫市\"},{\"id\":\"1156630000\",\"text\":\"青海\"},{\"id\":\"1156630200\",\"text\":\"海东市\"},{\"id\":\"1156632800\",\"text\":\"海西蒙古族藏族自治州\"},{\"id\":\"1156630100\",\"text\":\"西宁市\"},{\"id\":\"1156632700\",\"text\":\"玉树藏族自治州\"},{\"id\":\"1156632200\",\"text\":\"海北藏族自治州\"},{\"id\":\"1156632300\",\"text\":\"黄南藏族自治州\"},{\"id\":\"1156632500\",\"text\":\"海南藏族自治州\"},{\"id\":\"1156632600\",\"text\":\"果洛藏族自治州\"},{\"id\":\"1156610000\",\"text\":\"陕西\"},{\"id\":\"1156610900\",\"text\":\"安康市\"},{\"id\":\"1156610300\",\"text\":\"宝鸡市\"},{\"id\":\"1156610700\",\"text\":\"汉中市\"},{\"id\":\"1156611000\",\"text\":\"商洛市\"},{\"id\":\"1156610200\",\"text\":\"铜川市\"},{\"id\":\"1156610500\",\"text\":\"渭南市\"},{\"id\":\"1156610100\",\"text\":\"西安市\"},{\"id\":\"1156610400\",\"text\":\"咸阳市\"},{\"id\":\"1156610600\",\"text\":\"延安市\"},{\"id\":\"1156610800\",\"text\":\"榆林市\"},{\"id\":\"1156650000\",\"text\":\"*\"},{\"id\":\"1156652900\",\"text\":\"阿克苏地区\"},{\"id\":\"1156654300\",\"text\":\"阿勒泰地区\"},{\"id\":\"1156652800\",\"text\":\"巴音郭楞蒙古自治州\"},{\"id\":\"1156652700\",\"text\":\"博尔塔拉蒙古自治州\"},{\"id\":\"1156652300\",\"text\":\"昌吉回族自治州\"},{\"id\":\"1156650500\",\"text\":\"哈密市\"},{\"id\":\"1156653200\",\"text\":\"和田地区\"},{\"id\":\"1156653100\",\"text\":\"喀什地区\"},{\"id\":\"1156650200\",\"text\":\"克拉玛依市\"},{\"id\":\"1156654200\",\"text\":\"塔城地区\"},{\"id\":\"1156650400\",\"text\":\"吐鲁番市\"},{\"id\":\"1156650100\",\"text\":\"乌鲁木齐市\"},{\"id\":\"1156654000\",\"text\":\"伊犁哈萨克自治州\"},{\"id\":\"1156653000\",\"text\":\"克孜勒苏柯尔克孜\"},{\"id\":\"1156659000\",\"text\":\"自治区直辖县级行政区划\"},{\"id\":\"87\",\"text\":\"港澳台\"},{\"id\":\"1156669000\",\"text\":\"澳门\"},{\"id\":\"1156667000\",\"text\":\"香港\"},{\"id\":\"1156668000\",\"text\":\"*\"}]";
public static Map<String,String> getAllRegionMap(){
/*String[] cityStrs = regionAllStr.split(";");
for (String cityStr:cityStrs
) {
System.out.println(cityStr);
String[] cityData = cityStr.split(",");
}*/
// JSONArray jArray = JSONArray.fromObject(regionAllJsonStr);//old
// List<ExportRegionDO> regionlist = JSONArray.toList(jArray, ExportRegionDO.class, new JsonConfig());
//方式2
List<ExportRegionDO> regionlist = JSON.parseArray(regionAllJsonStr, ExportRegionDO.class);
HashMap<String, String> regionMap = new LinkedHashMap<>();
int i = 0;
for (ExportRegionDO region:regionlist
) {
System.out.println((++i)+"====:"+region.getId()+":"+region.getText());
regionMap.put(region.getId(), region.getText());
}
int j = 0;
for (String key : regionMap.keySet()) {
System.out.println((++j)+"==map==:"+key + ":" + regionMap.get(key));
}
return regionMap;
}
}
=====regionAllJsonStr是我通过 工具方法,生成的我需要的简化格式的 json串。(我只需要id和text数据,children属性不知道能不能用parseArr方法实现。)
====工具方法:【解析json。网上找的。###递归方式 解析任意深度的json数组】
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%--shiro标签--%>
<%@ taglib uri="http://shiro.apache.org/tags" prefix="shiro" %>
<jsp:include page="/WEB-INF/view/jsp/common/header.jsp"/>
<html>
<head>
<title>递归解析无限层级JSON的所有key和value</title>
<!--add-->
<script type="text/javascript" src="${baseResourcePath}/javascripts/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="${baseResourcePath}/js/Region.js"></script>
</head>
<body>
<div>
<ul id="menu">[</ul>
</div>
<script>
/*var menulist = [{
"menulist": [
{ "MID": "M001", "MName": "首页", "Url": "#", "menulist": "" },
{ "MID": "M002", "MName": "车辆买卖", "Url": "#", "menulist":
[
{ "MID": "M003", "MName": "新车", "Url": "#", "menulist":
[
{ "MID": "M006", "MName": "奥迪", "Url": "#", "menulist": "" },
{ "MID": "M007", "MName": "别克", "Url": "#", "menulist": "" }
]
},
{ "MID": "M004", "MName": "二手车", "Url": "#", "menulist": "" },
{ "MID": "M005", "MName": "改装车", "Url": "#", "menulist": "" }
]
},
{ "MID": "M006", "MName": "宠物", "Url": "#", "menulist": "" }
]
}];*/
$(function() {
parseJson(Region.REGION_LIST);
});
function parseJson(jsonObj) {
if( typeof(jsonObj) == "undefined" ){
alert('JSON对象不能为空!');
}
//遍历第一层数据
for (var topKey in jsonObj) {
//如果对象类型为object类型且数组长度大于0,递归继续解析
if (jsonObj[topKey].length > 0 && typeof(jsonObj[topKey]) == "object") {
parseJson(jsonObj[topKey]);
} else {
//如果对象类型为object类型,依次循环取出所有元素
if (typeof(jsonObj[topKey]) == "object") {
for(var childKey in jsonObj[topKey]) {
//如果对象类型为object类型,递归继续解析
if (typeof(jsonObj[topKey][childKey]) == "object") {
parseJson(jsonObj[topKey][childKey]);
} else {
//如果对象类型为object类型,直接取元素名称和值
if(childKey.indexOf("text")!=-1){
$("#menu").append('"'+childKey + '":"' + jsonObj[topKey][childKey] + '"},');
}else {
$("#menu").append('{"'+childKey + '":"' + jsonObj[topKey][childKey] + '",');
}
}
}
} else{
//如果对象类型为object类型,直接取元素名称和值
if(childKey.indexOf("text")!=-1){
$("#menu").append('"'+childKey + '":"' + jsonObj[topKey][childKey] + '"},');
}else {
$("#menu").append('{"'+childKey + '":"' + jsonObj[topKey][childKey] + '",');
}
}
}
}
}
</script>
</body>
</html>
上一篇: Flask上传文件