Question: I am trying to create an Xpath to click on radioButton. see below element and xpath from the web:

Xpath: 

```
/html/body/div[3]/div[2]/form/table/tbody/tr[5]/td[2]/label[1]/input

```

ELEMENT:

```
<input type="radio" ng-model="dataRow[column.map]" name="optionsRadios" value="15" class="ng-pristine ng-valid">

```

Answer: 
Gson deserializes any valid Json to `LinkedTreeMap`, like:

```
LinkedTreeMap<?,?> ltm = new Gson().fromJson(YOUR_JSON, LinkedTreeMap.class);

```

Then it is just about making some recursive methods to do the clean up:

```
public void alterEntry(Entry<?, ?> e) {
    if(e.getValue() instanceof Map) {
        alterMap((Map<?, ?>) e.getValue());
    } else {
        if(e.getKey().equals("secondName")) { // hard coded but you see the point 
            e.setValue(null); // we could remove the whole entry from the map
                              // but it makes thing more complicated. Setting null
                              // achieves the same.
        }
    }
}

public void alterMap(Map<?,?> map) {
    map.entrySet().forEach(this::alterEntry);
}

```

Usage:

```
alterMap(ltm);

```
You can do like below if you know the schema and heirarchy:

`JsonObject jsonObj= gson.fromJson(json, JsonObject.class);
jsonObj.getAsJsonObject("moreDetails").remove("secondName");
System.out.println(jsonObj.getAsString());`

refer this for more info [Remove key from a Json inside a JsonObject](https://stackoverflow.com/questions/34092346/remove-key-from-a-json-inside-a-jsonobject)

else you need to write a dynamic function which will check each and every element of JSON object and try to find the `secondName` element in it and remove it.

So consider here as you have multiple nested objects then you need to write a function which will iterate over each element and check its type if its again a jsonObject call the same method recursively or iteratively to check against current element, in each check you need to also verify that the key, if it matches with the key which has to be removed then you can remove it and continue the same.

for a hint on how to check a value type of JSON see this [How to check the type of a value from a JSONObject?](https://stackoverflow.com/questions/15920212/how-to-check-the-type-of-a-value-from-a-jsonobject)