|
5金钱
本帖最后由 无奇龙 于 2014-9-14 12:25 编辑
如下面的JSON字符串(只复制一个第一层子节点(以activity为根节点)),解析以后竞有5层,模索很久才会通过遍历找到指定goodsCode值,现在想按,"time“作为关键字对第一层子节点排序,实在想不到办法,不会用OrderBy,哪个大神能贴出一下示例代码
{"activity":[{"channel":"MAF_OD","code":"1141","endDate":{"date":14,"day":0,"hours":10,"minutes":59,"month":8,"nanos":0,"seconds":59,"time":1410663599000,"timezoneOffset":-480,"year":114},"id":0,"name":"9月14日手机一元秒杀9点场 ","seckillFold":"null","seckillSettingDtos":[{"goodsCode":48754801,"goodsName":"界江梅花鹿双宝鹿茸+鹿鞭10克","goodsPrice":82,"goodsPriceStr":"82.00","id":0,"listingId":487548,"seckillInfoCode":"1141","seckillPrice":1,"seckillPriceStr":"1.00","seckillRate":1,"sellLimitFlag":1,"sellStorageNum":20,"storageNum":20,"storeId":3082},{"goodsCode":36658802,"goodsName":"城口老腊肉麻辣腊肉丝120g","goodsPrice":35,"goodsPriceStr":"35.00","id":0,"listingId":366588,"seckillInfoCode":"1141","seckillPrice":1,"seckillPriceStr":"1.00","seckillRate":1,"sellLimitFlag":1,"sellStorageNum":20,"storageNum":20,"storeId":3018}],"sellTime":{"date":14,"day":0,"hours":10,"minutes":59,"month":8,"nanos":0,"seconds":59,"time":1410663599000,"timezoneOffset":-480,"year":114},"startDate":{"date":14,"day":0,"hours":9,"minutes":0,"month":8,"nanos":0,"seconds":0,"time":1410656400000,"timezoneOffset":-480,"year":114},"title":"9月14日手机一元秒杀9点场 ","type":1}]}
|
最佳答案
查看完整内容
对象里面不是List吗,这个随便写个排序就行了吧,比较冒泡,或者是二叉都行,
我的意思就是把转好的List的对象,进行一个排序,然后再转为Json就达到的效果,
我那里有说让你对字符串排序了,
|