有没有一种简单的方法可以根据不同的条件过滤json数据
我从以下Web服务之一获得以下数据作为响应。我想根据不同值的几种组合来过滤数据。最简单的方法是什么,以便确实影响我的Web服务的性能]
数据:我正在获取对象数组
[
{
"source": "9606.ENSP00000000233",
"target": "9606.ENSP00000366563",
"relationship": "ON_INTERACTION_WITH",
"relationshipdetails": {
"database4": "0",
"database3": "0",
"coexpression2": "42",
"coexpression3": "42",
"experimental": "174",
"database2": "0",
"combinedscore3": "298",
"combinedscore4": "298",
"experimental2": "174",
"combinedscore": "298",
"database": "0",
"combinedscore2": "298",
"experimental3": "174",
"experimental4": "174",
"coexpression4": "42",
"textmining3": "184",
"coexpression": "42",
"textmining4": "184",
"textmining2": "184",
"textmining": "184"
}
},
{
"source": "9606.ENSP00000000233",
"target": "9606.ENSP00000402551",
"relationship": "ON_INTERACTION_WITH",
"relationshipdetails": {
"database4": "0",
"database3": "0",
"coexpression2": "148",
"coexpression3": "148",
"experimental": "138",
"database2": "0",
"combinedscore3": "247",
"combinedscore4": "247",
"experimental2": "138",
"combinedscore": "247",
"database": "0",
"combinedscore2": "247",
"experimental3": "138",
"experimental4": "138",
"coexpression4": "148",
"textmining3": "57",
"coexpression": "148",
"textmining4": "57",
"textmining2": "57",
"textmining": "57"
}
},
{
"source": "9606.ENSP00000000233",
"target": "9606.ENSP00000386239",
"relationship": "ON_INTERACTION_WITH",
"relationshipdetails": {
"database4": "0",
"database3": "0",
"coexpression2": "49",
"coexpression3": "49",
"experimental": "120",
"database2": "0",
"combinedscore3": "190",
"combinedscore4": "190",
"experimental2": "120",
"combinedscore": "190",
"database": "0",
"combinedscore2": "190",
"experimental3": "120",
"experimental4": "120",
"coexpression4": "49",
"textmining3": "110",
"coexpression": "49",
"textmining4": "110",
"textmining2": "110",
"textmining": "110"
}
}
]
条件:where textmining >/</= 100 and coexpression >/</= 30 and combinedscore >/</= 250
必须根据大于/等于/小于条件的5个过滤器值(文本挖掘,共表达,实验,数据库和组合分数)对数据进行过滤,并且必须使用所有这些输入。
的确取决于要对数组进行specific
的execute
逻辑。但通常获取值并比较值,我认为更好的选择是循环。
示例:
for(let i =0; i++;i<array.length)
{
logic
}
有没有一种简单的方法可以根据不同的条件过滤json数据
我从以下Web服务之一获得以下数据作为响应。我想根据不同值的几种组合来过滤数据。最简单的方法是什么,以便确实影响我的Web服务的性能]
数据:我正在获取对象数组
[
{
"source": "9606.ENSP00000000233",
"target": "9606.ENSP00000366563",
"relationship": "ON_INTERACTION_WITH",
"relationshipdetails": {
"database4": "0",
"database3": "0",
"coexpression2": "42",
"coexpression3": "42",
"experimental": "174",
"database2": "0",
"combinedscore3": "298",
"combinedscore4": "298",
"experimental2": "174",
"combinedscore": "298",
"database": "0",
"combinedscore2": "298",
"experimental3": "174",
"experimental4": "174",
"coexpression4": "42",
"textmining3": "184",
"coexpression": "42",
"textmining4": "184",
"textmining2": "184",
"textmining": "184"
}
},
{
"source": "9606.ENSP00000000233",
"target": "9606.ENSP00000402551",
"relationship": "ON_INTERACTION_WITH",
"relationshipdetails": {
"database4": "0",
"database3": "0",
"coexpression2": "148",
"coexpression3": "148",
"experimental": "138",
"database2": "0",
"combinedscore3": "247",
"combinedscore4": "247",
"experimental2": "138",
"combinedscore": "247",
"database": "0",
"combinedscore2": "247",
"experimental3": "138",
"experimental4": "138",
"coexpression4": "148",
"textmining3": "57",
"coexpression": "148",
"textmining4": "57",
"textmining2": "57",
"textmining": "57"
}
},
{
"source": "9606.ENSP00000000233",
"target": "9606.ENSP00000386239",
"relationship": "ON_INTERACTION_WITH",
"relationshipdetails": {
"database4": "0",
"database3": "0",
"coexpression2": "49",
"coexpression3": "49",
"experimental": "120",
"database2": "0",
"combinedscore3": "190",
"combinedscore4": "190",
"experimental2": "120",
"combinedscore": "190",
"database": "0",
"combinedscore2": "190",
"experimental3": "120",
"experimental4": "120",
"coexpression4": "49",
"textmining3": "110",
"coexpression": "49",
"textmining4": "110",
"textmining2": "110",
"textmining": "110"
}
}
]
条件:where textmining >/</= 100 and coexpression >/</= 30 and combinedscore >/</= 250
必须根据大于/等于/小于条件的5个过滤器值(文本挖掘,共表达,实验,数据库和组合分数)对数据进行过滤,并且必须使用所有这些输入。
的确取决于要对数组进行specific
的execute
逻辑。但通常获取值并比较值,我认为更好的选择是循环。
示例:
for(let i =0; i++;i<array.length)
{
logic
}