【发布时间】:2021-01-19 11:59:37
【问题描述】:
我有 3 个JSON 有效载荷:A、B 和 C。我需要确定有效载荷A 是否包含B 和C。
- 当
B与A进行比较时,我需要得到true的结果。 - 当
C与A进行比较时,我需要结果为false因为college密钥在有效载荷A中不存在。
注意:JSON 下面的有效载荷只是示例,可以有不同的结构和值。
有效载荷A:
{
"id": "1",
"search": {
"name": "Testing",
"age": "25",
"school": "sacred heart"
},
"Address": {
"street": "Abcedf",
"road": "4th cross",
"city": "bangalore"
}
}
有效载荷B
{
"id": "1",
"search": {
"name": "Testing"
},
"Address": {
"street": "Abcedf",
"road": "4th cross"
}
}
有效载荷C
{
"id": "1",
"search": {
"name": "Testing",
"college": "global"
},
"Address": {
"street": "Abcedf",
"road": "4th cross"
}
}
【问题讨论】:
标签: java json jackson gson contains