对于从服务端返回的json字符串往往晦涩难懂,这就需要格式化一下,关于格式化json字符串有两种方法。
第一种:在线转换,这种方法大家用的最多,这里不啰嗦了。
第二种:本地转换
在公司,有可能是不让上网的,这种情况下,有个本地转换工具是必须的,大家可以到http://download.csdn.net/detail/u012453843/9819351这个地址进行下载。下载完之后进行解压,然后双击JsonView.exe打开界面,并随便在里面输入一个json串,如:[{"srcB":"http://image.taotao.com/images/2015/03/03/2015030304360302109345.jpg","height":240,"alt":"","width":670,"src":"http://image.taotao.com/images/2015/03/03/2015030304360302109345.jpg","widthB":550,"href":"http://sale.jd.com/act/e0FMkuDhJz35CNt.html?cpdad=1DLSUE","heightB":240},{"srcB":"http://image.taotao.com/images/2015/03/03/2015030304353109508500.jpg","src":"http://image.taotao.com/images/2015/03/03/2015030304353109508500.jpg","href":"http://sale.jd.com/act/UMJaAPD2VIXkZn.html?cpdad=1DLSUE",{"srcB":"http://image.taotao.com/images/2015/03/03/2015030304345761102862.jpg","src":"http://image.taotao.com/images/2015/03/03/2015030304345761102862.jpg",{"srcB":"http://image.taotao.com/images/2015/03/03/201503030434200950530.jpg","src":"http://image.taotao.com/images/2015/03/03/201503030434200950530.jpg","href":"http://sale.jd.com/act/kj2pmwMuYCrGsK3g.html?cpdad=1DLSUE",{"srcB":"http://image.taotao.com/images/2015/03/03/2015030304333327002286.jpg","src":"http://image.taotao.com/images/2015/03/03/2015030304333327002286.jpg","href":"http://sale.jd.com/act/xcDvNbzAqK0CoG7I.html?cpdad=1DLSUE",{"srcB":"http://image.taotao.com/images/2015/03/03/2015030304324649807137.jpg","src":"http://image.taotao.com/images/2015/03/03/2015030304324649807137.jpg","href":"http://sale.jd.com/act/eDpBF1s8KcTOYM.html?cpdad=1DLSUE","heightB":240}];
如下图所示,我们点击“Format”进行格式化。
格式化后如下图所示。
原文链接:https://www.f2er.com/json/288947.html