用java语言如何写出这样的文件?

dirtymac 发布于 2013/11/28 14:22
阅读 300
收藏 1

{
   "name":"iphone5",
           "children":[
       
       {
           "name":"积极的",
           "children":[
               {"name":"屏幕",
                   "children":[
                       {"name":"包装非常严实 5也是我爱的~大屏幕比4S爽","size":1},
                       {"name":"送货很快,拿到了就爱不释手,速度很快,屏幕大小也合适。已经买了第二个了。","size":1},
                       {"name":"轻 长 薄 屏幕不错 ","size":1},
                       {"name":"运行速度快,屏幕显示效果好,质感非常不错。。比4s强多了,我的机器暂时没掉漆","size":1},
                       {"name":"超大的屏幕,舒适的手感 ,不凡的功能,时尚的外观,操作起来简单易懂,是一款值得拥有的手机来的!","size":1},
                       {"name":"不错,喜欢!屏幕清晰度确实比别的手机好,但是刚开始用这个系统的还有点不习惯! ","size":1},
                       {"name":"单位礼品,屏幕够大,够时尚,不错! ","size":1},
                       {"name":"屏幕清晰手感不错。是正品,","size":1}
                       ]
                       },
                   {"name":"系统",
                       "children":[
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1}
                       ]
                      },
                   {
                      "name":"流畅度",
                      "children":[
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1}
                       ]
                      },
                   {
                       "name":"耳机",
                       "children":[
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1}
                       ]
                      }
           ]
             
    },
    {
        "name":"消极的",
        "children":[
            {
                "name":"屏幕",
                "children":[
                       {"name":"其他还好,就是屏幕是暖色屏","size":1},
                       {"name":"还不错挺好的,就是屏幕触摸不是很灵敏,不知到是不是5都这样?","size":1},
                       {"name":"送人的,还属于时尚电子用品。不过屏幕太小了,三星有点儿取而代之的趋势了。 ","size":1},
                       {"name":"没有掉漆现象,就是屏幕有一排黄斑","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1}
                       ]
            },
            {
                "name":"系统",
                "children":[
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1}
                       ]
            },
             {
                      "name":"流畅度",
                      "children":[
                       {"name":"屏幕很小","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1}
                       ]
                      },
                       {
                       "name":"耳机",
                       "children":[
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1},
                       {"name":"屏幕很大","size":1}
                       ]
                      }
            
            
        ]
    }
           
           ]
          
               
           
}



加载中
0
红薯
红薯

这是 JSON 格式,有很多库可以生成,请看:

http://www.oschina.net/project/tag/228/json

dirtymac
dirtymac
我比较小白,如何动态生成呢?详细解答一下呗
0
Neo_
Neo_
fastjson 阿里巴巴的 直接把数组转成 json~
0
gongweixin
gongweixin
会自己写java类不?会使用第三方jar包不?如果不会,看java基础去,如果会,你就可以用 http://www.oschina.net/project/tag/228/json这里的工具把你写的类生成出你要的格式了。google一下 java json
返回顶部
顶部