• (转)淘淘商城系列——使用JsonView来格式化json字符串


    http://blog.csdn.net/yerenyuan_pku/article/details/72846025

    有时从服务端返回的json字符串往往晦涩难懂,就像下面这样,一行显示出来,让人非常头痛。 

    这时我们就需要对其格式化一下了,关于格式化json字符串有两种方法。

    1. 第一种:在线转换,这种方法大家用的最多,这里就不啰嗦了。
    2. 第二种:本地转换。

    本文我们就只介绍第二张方法。因为在公司里,有可能是不让上网的,这种情况下,有个本地转换工具是必须的。我本人下载的转换工具是JsonView,目录结构如下图所示: 

    我们只须双击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","height":240,"alt":"","width":670,"src":"http://image.taotao.com/images/2015/03/03/2015030304353109508500.jpg","widthB":550,"href":"http://sale.jd.com/act/UMJaAPD2VIXkZn.html?cpdad=1DLSUE","heightB":240},{"srcB":"http://image.taotao.com/images/2015/03/03/2015030304345761102862.jpg","height":240,"alt":"","width":670,"src":"http://image.taotao.com/images/2015/03/03/2015030304345761102862.jpg","widthB":550,"href":"http://sale.jd.com/act/UMJaAPD2VIXkZn.html?cpdad=1DLSUE","heightB":240},{"srcB":"http://image.taotao.com/images/2015/03/03/201503030434200950530.jpg","height":240,"alt":"","width":670,"src":"http://image.taotao.com/images/2015/03/03/201503030434200950530.jpg","widthB":550,"href":"http://sale.jd.com/act/kj2pmwMuYCrGsK3g.html?cpdad=1DLSUE","heightB":240},{"srcB":"http://image.taotao.com/images/2015/03/03/2015030304333327002286.jpg","height":240,"alt":"","width":670,"src":"http://image.taotao.com/images/2015/03/03/2015030304333327002286.jpg","widthB":550,"href":"http://sale.jd.com/act/xcDvNbzAqK0CoG7I.html?cpdad=1DLSUE","heightB":240},{"srcB":"http://image.taotao.com/images/2015/03/03/2015030304324649807137.jpg","height":240,"alt":"","width":670,"src":"http://image.taotao.com/images/2015/03/03/2015030304324649807137.jpg","widthB":550,"href":"http://sale.jd.com/act/eDpBF1s8KcTOYM.html?cpdad=1DLSUE","heightB":240}]
    • 1
    • 1

    如下图所示,我们点击“Format”进行格式化。 

    格式化后的效果如下图所示。 

  • 相关阅读:
    python 企业微信告警
    容器启动报错listen unix /containerd-shim/moby/9a3b9086ece8fcd8746695836e3f057cc0313b3cdb722d76a5f571dfa428759e/shim.sock: bind: address already in use: unknown
    etcd查询k8s相关数据
    hadoop三大核心组件概念及原理
    使用nginx反代实现k8s apiserver高可用
    k8s useraccout账号创建及RDBA授权
    k8s之二进制部署
    git代码提交后jenkins的构建与持续部署
    dockerfile动态修改服务配置文件
    数据库操作语句DDL,DML,DCL
  • 原文地址:https://www.cnblogs.com/telwanggs/p/6946045.html
Copyright © 2020-2023  润新知