I have a json as buffer and I need to remove a set of keys from it. The json is pretty big and I do not want to cast it into JsonObject. Let's say I want to remove key a, b, c, d and e only from top level json (depth=0) and not from depth 1 onwards.
It would be great if depth can be taken as an argument as well to support deletion from child as well.
So if I have a json as this:
{
"a": "1",
"b": {
"b1": 2
},
"c": [
"3",
{
"c1": 4
},
[
9,
10
]
],
"d": false,
"e": 1.0,
"f": {
"a": 1
},
"g": [
{
"b": 2
}
],
"h": {
"c": [
"3",
{
"c1": 4
},
[
9,
10
]
]
},
"j": {
"d": true,
"e": 1.0
},
"k": true
}
I want to use vert.x JsonParser to remove a, b, c, d and e and get this as the final buffer
{
"f": {
"a": 1
},
"g": [
{
"b": 2
}
],
"h": {
"c": [
"3",
{
"c1": 4
},
[
9,
10
]
]
},
"j": {
"d": true,
"e": 1.0
},
"k": true
}
Can you please help me with this. I am on vert.x 4.5.13
Preferred is vert.x solution but I am also ok with Jakarta JsonParser library as well