我想知道如何取消或销毁一级json对象。这可以使用任何javaspring框架来完成,也可以为这个解决方案定义任何自定义功能。但需要保留“txtframearr”的inside数组中的数据,如下所示
[
{
"txtFrameArr": {
"CEPDuplicateTextFrame1": [
{
"marked": 1,
"id_elems": [
{
"PS": "1",
"OS": "1",
"LS": "999",
"name": "MARKETING_CLAIM",
"IS": "1",
"id": "CE-MARKETING_CLAIM-1_999_1_1"
}
],
"mapCordinates": [
{
"top": 468.645102009805,
"left": 1053.47265625,
"width": 30.8357511971699,
"height": 132.963461384805
},
{
"top": 513.29412308266,
"left": 1067.05751323149,
"width": 91.1260246588899,
"height": 233.24627152016
}
],
"duplicate": 1,
"content": "baby-dry pants",
"txtframe_name": "ceptxtduplicateTF1-threaded1"
}
]
}
},
{
"txtFrameArr": {
"CEPTextFrame2": [
{
"marked": 1,
"id_elems": [
{
"PS": "1",
"OS": "1",
"LS": "2",
"name": "NET_CONTENT_STATEMENT",
"IS": "1",
"id": "CE-NET_CONTENT_STATEMENT-1_2_1_1"
}
],
"mapCordinates": [
{
"top": 22.599609375,
"left": 740.23886611805,
"width": 22.9008135909007,
"height": 33.8291015625
},
{
"top": -6.76171875,
"left": 744.522124684196,
"width": 15.4768987533043,
"height": 9.2734375
},
{
"top": -14.33203125,
"left": 740.448785213874,
"width": 22.2500000017299,
"height": 6.88811848711339
}
],
"duplicate": 0,
"content": "4단계 9-14 kg",
"txtframe_name": "ceptxtCE-NET_CONTENT_STATEMENT-1_2_1_1-threaded2"
}
]
}
},
{
"txtFrameArr": {
"CEPTextFrame3": [
{
"marked": 1,
"id_elems": [
{
"PS": "1",
"OS": "1",
"LS": "2",
"name": "USAGE_INSTRUCTIONS",
"IS": "4",
"id": "CE-USAGE_INSTRUCTIONS-4_2_1_1"
}
],
"mapCordinates": [
{
"top": 215.9384765625,
"left": -639.0234375,
"width": 29.1552734375,
"height": 55.2314453125
}
],
"duplicate": 0,
"content": "위로 당기며 입혀줍니다",
"txtframe_name": "ceptxtCE-USAGE_INSTRUCTIONS-4_2_1_1-3"
}
]
}
}
]
Supposed to be wanted like this by removing "txtFrameArr"
[
{
"CEPDuplicateTextFrame1": [
{
"marked": 1,
"id_elems": [
{
"PS": "1",
"OS": "1",
"LS": "999",
"name": "MARKETING_CLAIM",
"IS": "1",
"id": "CE-MARKETING_CLAIM-1_999_1_1"
}
],
"mapCordinates": [
{
"top": 468.645102009805,
"left": 1053.47265625,
"width": 30.8357511971699,
"height": 132.963461384805
},
{
"top": 513.29412308266,
"left": 1067.05751323149,
"width": 91.1260246588899,
"height": 233.24627152016
}
],
"duplicate": 1,
"content": "baby-dry pants",
"txtframe_name": "ceptxtduplicateTF1-threaded1"
}
]
},
{
"CEPTextFrame2": [
{
"marked": 1,
"id_elems": [
{
"PS": "1",
"OS": "1",
"LS": "2",
"name": "NET_CONTENT_STATEMENT",
"IS": "1",
"id": "CE-NET_CONTENT_STATEMENT-1_2_1_1"
}
],
"mapCordinates": [
{
"top": 22.599609375,
"left": 740.23886611805,
"width": 22.9008135909007,
"height": 33.8291015625
},
{
"top": -6.76171875,
"left": 744.522124684196,
"width": 15.4768987533043,
"height": 9.2734375
},
{
"top": -14.33203125,
"left": 740.448785213874,
"width": 22.2500000017299,
"height": 6.88811848711339
}
],
"duplicate": 0,
"content": "4단계 9-14 kg",
"txtframe_name": "ceptxtCE-NET_CONTENT_STATEMENT-1_2_1_1-threaded2"
}
]
},
{
"CEPTextFrame3": [
{
"marked": 1,
"id_elems": [
{
"PS": "1",
"OS": "1",
"LS": "2",
"name": "USAGE_INSTRUCTIONS",
"IS": "4",
"id": "CE-USAGE_INSTRUCTIONS-4_2_1_1"
}
],
"mapCordinates": [
{
"top": 215.9384765625,
"left": -639.0234375,
"width": 29.1552734375,
"height": 55.2314453125
}
],
"duplicate": 0,
"content": "위로 당기며 입혀줍니다",
"txtframe_name": "ceptxtCE-USAGE_INSTRUCTIONS-4_2_1_1-3"
}
]
}
]
Supposed to be wanted like this by removing "txtFrameArr"
I need to remove {"txtFrameArr"} but the key,value needs to be retain
Is there any specific function in Java Spring for this solution?
应该是通过删除“txtframearr”来实现的
Is there any specific function in Java Spring for this solution?
1条答案
按热度按时间enxuqcxy1#
如果我正确理解你的意思-你可以使用json路径:
获取对象txtframearr键的所有值。
使用提取的值创建新的json数组:
第一步-你可以使用com.jayway。jsonpath:json-path:*,对于第二步-gson或jackson
代码如下所示: