数组对象按要求去除指定对象
原数组
[
{
"type": 1,
"count": 782,
"begin": 0,
"end": 100,
"countRate": 99.36,
"proCount": 4619,
"avgProCount": 5.91,
"rate": 94.96,
"amount": 21966.93
},
{
"amount": 0,
"avgProCount": 0,
"begin": 0,
"count": 0,
"countRate": 0,
"end": 100,
"proCount": 0,
"rate": 0,
"type": 1
},
{
"amount": 0,
"avgProCount": 0,
"begin": 100,
"count": 0,
"countRate": 0,
"end": 200,
"proCount": 0,
"rate": 0,
"type": 1
},
{
"type": 1,
"count": 4,
"begin": 100,
"end": 200,
"countRate": 0.51,
"proCount": 29,
"avgProCount": 7.25,
"rate": 2.51,
"amount": 579.84
},
{
"amount": 0,
"avgProCount": 0,
"begin": 200,
"count": 0,
"countRate": 0,
"end": 300,
"proCount": 0,
"rate": 0,
"type": 1
},
{
"amount": 0,
"avgProCount": 0,
"begin": 300,
"count": 0,
"countRate": 0,
"end": 400,
"proCount": 0,
"rate": 0,
"type": 1
},
{
"amount": 0,
"avgProCount": 0,
"begin": 400,
"count": 0,
"countRate": 0,
"end": 500,
"proCount": 0,
"rate": 0,
"type": 1
},
{
"amount": 0,
"avgProCount": 0,
"begin": 500,
"count": 0,
"countRate": 0,
"end": 0,
"proCount": 0,
"rate": 0,
"type": 1
},
{
"type": 1,
"count": 1,
"begin": 500,
"end": 0,
"countRate": 0.13,
"proCount": 61,
"avgProCount": 61,
"rate": 2.53,
"amount": 585.6
}
]
要求变成这样
[
{
"type": 1,
"count": 782,
"begin": 0,
"end": 100,
"countRate": 99.36,
"proCount": 4619,
"avgProCount": 5.91,
"rate": 94.96,
"amount": 21966.93
},
{
"type": 1,
"count": 4,
"begin": 100,
"end": 200,
"countRate": 0.51,
"proCount": 29,
"avgProCount": 7.25,
"rate": 2.51,
"amount": 579.84
},
{
"amount": 0,
"avgProCount": 0,
"begin": 200,
"count": 0,
"countRate": 0,
"end": 300,
"proCount": 0,
"rate": 0,
"type": 1
},
{
"amount": 0,
"avgProCount": 0,
"begin": 300,
"count": 0,
"countRate": 0,
"end": 400,
"proCount": 0,
"rate": 0,
"type": 1
},
{
"amount": 0,
"avgProCount": 0,
"begin": 400,
"count": 0,
"countRate": 0,
"end": 500,
"proCount": 0,
"rate": 0,
"type": 1
},
{
"type": 1,
"count": 1,
"begin": 500,
"end": 0,
"countRate": 0.13,
"proCount": 61,
"avgProCount": 61,
"rate": 2.53,
"amount": 585.6
}
]
根据每个对象里面的begin和end对比,保留有其他值的那一个
有没有什么快捷的方式完成??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
结果:
数据
方法
结果