I have a json string 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 (so no objectValueMode or arrayValueMode). 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.
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.
Additionally, it would be great if depth can be taken as an argument as well to support deletion from child as well.
Corresponding stackoverflow link: https://stackoverflow.com/questions/79546076/usage-of-jsonparser-to-remove-set-of-specific-key-from-top-level-jsonobject