[{
"time": "2021-03-05T06:33:58.207Z",
"ln": "celGGIO1.AnIn70.mag.f",
"stVal": "null",
"value": "20.3"
}, {
"time": "2021-03-05T06:33:58.21Z",
"ln": "celGGIO1.AnIn70.mag.f",
"stVal": "null",
"value": "20.3"
}, {
"time": "2021-03-05T06:33:58.214Z",
"ln": "celGGIO1.AnIn70.mag.f",
"stVal": "null",
"value": "20.3"
}, {
"time": "2021-03-05T06:33:58.22Z",
"ln": "celGGIO1.AnIn70.mag.f",
"stVal": "null",
"value": "20.3"
}, {
"time": "2021-03-05T06:33:58.231Z",
"ln": "celGGIO1.AnIn71.mag.f",
"stVal": "null",
"value": "20.3"
}, {
"time": "2021-03-05T06:33:58.235Z",
"ln": "celGGIO1.AnIn71.mag.f",
"stVal": "null",
"value": "20.3"
}, {
"time": "2021-03-05T06:33:58.239Z",
"ln": "celGGIO1.AnIn71.mag.f",
"stVal": "null",
"value": "20.3"
}, {
"time": "2021-03-05T06:33:58.245Z",
"ln": "celGGIO1.AnIn71.mag.f",
"stVal": "null",
"value": "20.3"
}, {
"time": "2021-03-05T06:33:58.254Z",
"ln": "celGGIO1.AnIn72.mag.f",
"stVal": "null",
"value": "20.2"
}, {
"time": "2021-03-05T06:33:58.258Z",
"ln": "celGGIO1.AnIn72.mag.f",
"stVal": "null",
"value": "20.2"
}, {
"time": "2021-03-05T06:33:58.262Z",
"ln": "celGGIO1.AnIn72.mag.f",
"stVal": "null",
"value": "20.2"
}, {
"time": "2021-03-05T06:33:58.268Z",
"ln": "celGGIO1.AnIn72.mag.f",
"stVal": "null",
"value": "20.2"
}, {
"time": "2021-03-05T06:33:58.28Z",
"ln": "celGGIO1.AnIn73.mag.f",
"stVal": "null",
"value": "487.923"
}, {
"time": "2021-03-05T06:33:58.284Z",
"ln": "celGGIO1.AnIn73.mag.f",
"stVal": "null",
"value": "487.923"
}, {
"time": "2021-03-05T06:33:58.288Z",
"ln": "celGGIO1.AnIn73.mag.f",
"stVal": "null",
"value": "487.923"
}, {
"time": "2021-03-05T06:33:58.294Z",
"ln": "celGGIO1.AnIn73.mag.f",
"stVal": "null",
"value": "487.923"
}, {
"time": "2021-03-05T06:33:58.305Z",
"ln": "celGGIO1.AnIn74.mag.f",
"stVal": "null",
"value": "491.546"
}, {
"time": "2021-03-05T06:33:58.308Z",
"ln": "celGGIO1.AnIn74.mag.f",
"stVal": "null",
"value": "491.546"
}, {
"time": "2021-03-05T06:33:58.313Z",
"ln": "celGGIO1.AnIn74.mag.f",
"stVal": "null",
"value": "491.546"
}, {
"time": "2021-03-05T06:33:58.319Z",
"ln": "celGGIO1.AnIn74.mag.f",
"stVal": "null",
"value": "491.546"
}, {
"time": "2021-03-05T06:33:58.33Z",
"ln": "celGGIO1.AnIn75.mag.f",
"stVal": "null",
"value": "491.546"
}, {
"time": "2021-03-05T06:33:58.334Z",
"ln": "celGGIO1.AnIn75.mag.f",
"stVal": "null",
"value": "491.546"
}, {
"time": "2021-03-05T06:33:58.339Z",
"ln": "celGGIO1.AnIn75.mag.f",
"stVal": "null",
"value": "491.546"
}, {
"time": "2021-03-05T06:33:58.345Z",
"ln": "celGGIO1.AnIn75.mag.f",
"stVal": "null",
"value": "491.546"
}, {
"time": "2021-03-05T06:33:58.356Z",
"ln": "celGGIO1.AnIn76.mag.f",
"stVal": "null",
"value": "484.3"
}, {
"time": "2021-03-05T06:33:58.359Z",
"ln": "celGGIO1.AnIn76.mag.f",
"stVal": "null",
"value": "484.3"
}, {
"time": "2021-03-05T06:33:58.362Z",
"ln": "celGGIO1.AnIn76.mag.f",
"stVal": "null",
"value": "484.3"
}, {
"time": "2021-03-05T06:33:58.368Z",
"ln": "celGGIO1.AnIn76.mag.f",
"stVal": "null",
"value": "484.3"
}, {
"time": "2021-03-05T06:33:58.378Z",
"ln": "celGGIO1.AnIn77.mag.f",
"stVal": "null",
"value": "490.338"
}, {
"time": "2021-03-05T06:33:58.381Z",
"ln": "celGGIO1.AnIn77.mag.f",
"stVal": "null",
"value": "490.338"
}, {
"time": "2021-03-05T06:33:58.384Z",
"ln": "celGGIO1.AnIn77.mag.f",
"stVal": "null",
"value": "490.338"
}, {
"time": "2021-03-05T06:33:58.39Z",
"ln": "celGGIO1.AnIn77.mag.f",
"stVal": "null",
"value": "490.338"
}, {
"time": "2021-03-05T06:33:58.4Z",
"ln": "celGGIO1.AnIn78.mag.f",
"stVal": "null",
"value": "489.13"
}, {
"time": "2021-03-05T06:33:58.403Z",
"ln": "celGGIO1.AnIn78.mag.f",
"stVal": "null",
"value": "489.13"
}, {
"time": "2021-03-05T06:33:58.407Z",
"ln": "celGGIO1.AnIn78.mag.f",
"stVal": "null",
"value": "489.13"
}, {
"time": "2021-03-05T06:33:58.413Z",
"ln": "celGGIO1.AnIn78.mag.f",
"stVal": "null",
"value": "489.13"
}, {
"time": "2021-03-05T06:33:58.425Z",
"ln": "celGGIO1.AnIn79.mag.f",
"stVal": "null",
"value": "485.507"
}, {
"time": "2021-03-05T06:33:58.43Z",
"ln": "celGGIO1.AnIn79.mag.f",
"stVal": "null",
"value": "485.507"
}, {
"time": "2021-03-05T06:33:58.435Z",
"ln": "celGGIO1.AnIn79.mag.f",
"stVal": "null",
"value": "485.507"
}, {
"time": "2021-03-05T06:33:58.441Z",
"ln": "celGGIO1.AnIn79.mag.f",
"stVal": "null",
"value": "485.507"
}, {
"time": "2021-03-05T06:33:58.451Z",
"ln": "celGGIO1.AnIn80.mag.f",
"stVal": "null",
"value": "481.884"
}, {
"time": "2021-03-05T06:33:58.455Z",
"ln": "celGGIO1.AnIn80.mag.f",
"stVal": "null",
"value": "481.884"
}, {
"time": "2021-03-05T06:33:58.46Z",
"ln": "celGGIO1.AnIn80.mag.f",
"stVal": "null",
"value": "481.884"
}, {
"time": "2021-03-05T06:33:58.467Z",
"ln": "celGGIO1.AnIn80.mag.f",
"stVal": "null",
"value": "481.884"
}]
如何将转换为json的数据进行排序并去重呢
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
6条回答 默认 最新
- l759692959 2021-03-12 09:29关注
1.com.alibaba.fastjson
JSONArray jsonArray = JSON.parseArray(text);
2. jdk 1.8
jsonArray = IntStream.rangeClosed(0, jsonArray.size() - 1).mapToObj(jsonArray::getJSONObject).sorted(Comparator.comparing((JSONObject jsonObject) -> jsonObject.getString("time")).thenComparing(jsonObject -> jsonObject.getString("value"))).distinct().collect(Collectors.toCollection(JSONArray::new));
先按照time再按照value排序;
3.输出查看结果
jsonArray.forEach(System.out::println);
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 2无用
悬赏问题
- ¥15 如何绘制动力学系统的相图
- ¥15 对接wps接口实现获取元数据
- ¥20 给自己本科IT专业毕业的妹m找个实习工作
- ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
- ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)
- ¥50 mac mini外接显示器 画质字体模糊
- ¥15 TLS1.2协议通信解密
- ¥40 图书信息管理系统程序编写
- ¥20 Qcustomplot缩小曲线形状问题
- ¥15 企业资源规划ERP沙盘模拟