js拼接?
如下json字串:
var json = [{"time":"2013-11-11","gn":"自定义分组1","inCount":261},{"time":"2013-11-12","gn":"自定义分组1","inCount":654},,{"time":"2013-11-11","gn":"自定义分组2","inCount":152},{"time":"2013-11-12","gn":"自定义分组2","inCount":362}]
想把 自定义分组1 拼在一起
自定义分组2 拼在一起
最后成这样:[{"time":["2013-11-11","2013-11-12"],"gn":"自定义分组1","inCount":[261,654]},{"time":["2013-11-11","2013-11-12"],"gn":"自定义分组2","inCount":[152,362]}]
怎么样拼?谢谢.
------解决方案--------------------把里面的json循环输出,重新拼接成新的JSON!
------解决方案--------------------序列化,做逻辑处理
再反序列化