有句名言,叫做10000小时成为某一个领域的专家。姑且不辩论这句话是否正确,让我们到达10000小时的时候再回头来看吧。
Hour 38
其实就是所谓的json 转对象的问题,这里就要面临很多开源方案的选择了。
这里随便一搜有json-lib,fastjson 之类的,暂时也不需要比较它们的区别,先随便用其中的fastjson吧。
首先看下我们需要解析的json
{"weatherinfo":{"city":"杭州","city_en":"hangzhou","date_y":"2013年11月14日","date":"","week":"星期四","fchh":"18","cityid":"101210101","temp1":"10℃~18℃","temp2":"9℃~20℃","temp3":"8℃~16℃","temp4":"6℃~15℃","temp5":"5℃~17℃","temp6":"6℃~17℃","tempF1":"50℉~64.4℉","tempF2":"48.2℉~68℉","tempF3":"46.4℉~60.8℉","tempF4":"42.8℉~59℉","tempF5":"41℉~62.6℉","tempF6":"42.8℉~62.6℉","weather1":"阴转多云","weather2":"晴转多云","weather3":"晴转多云","weather4":"晴转多云","weather5":"晴转多云","weather6":"晴转多云","img1":"2","img2":"1","img3":"0","img4":"1","img5":"0","img6":"1","img7":"0","img8":"1","img9":"0","img10":"1","img11":"0","img12":"1","img_single":"1","img_title1":"阴","img_title2":"多云","img_title3":"晴","img_title4":"多云","img_title5":"晴","img_title6":"多云","img_title7":"晴","img_title8":"多云","img_title9":"晴","img_title10":"多云","img_title11":"晴","img_title12":"多云","img_title_single":"多云","wind1":"微风","wind2":"东风小于3级","wind3":"西北风小于3级","wind4":"北风小于3级","wind5":"北风小于3级","wind6":"东南风小于3级","fx1":"微风","fx2":"微风","fl1":"小于3级","fl2":"小于3级","fl3":"小于3级","fl4":"小于3级","fl5":"小于3级","fl6":"小于3级","index":"较舒适","index_d":"建议着薄外套、开衫牛仔衫裤等服装。年老体弱者应适当添加衣物,宜着夹克衫、薄毛衣等。","index48":"较冷","index48_d":"建议着大衣、呢外套加毛衣、卫衣等服装。体弱者宜着厚外套、厚毛衣。因昼夜温差较大,注意增减衣服。","index_uv":"弱","index48_uv":"弱","index_xc":"适宜","index_tr":"适宜","index_co":"舒适","st1":"18","st2":"9","st3":"21","st4":"10","st5":"15","st6":"9","index_cl":"适宜","index_ls":"适宜","index_ag":"极不易发"}}
就先只解析一个字段city
今天由于这个maven 的debug 的问题,严重超时。
首先必须有一个明确的概念,调试是jvm 自带的一个东西,和maven 关系不是很大。
所以只要maven 以调试模式启动,eclipse 可以以附加进程的方式调试。
1 首先配置 run ,
2 其次配置 debug, 以远程的形式访问
3 开启run, 然后attach, 设置断点,bingo
不得不说,刚开始一直在纠结maven 自带的调试完全进不了断点,也许是可以的,这个需要稍后查看官方文档。
目前以attach 的形式调试,对于我来说也是可以的。
因此这个系列又得明天继续。
今天大大的超时!!!