Could you help me with this issue please. for example I have JSONEObject
{
\"glossary\": {
\"title\": \"example glossary\",
\"GlossDiv\": {
\"ti
Here i have written a simple function with recursion:
public static JSONObject replaceAll(JSONObject json, String key, String newValue) throws JSONException {
Iterator> keys = json.keys();
while (keys.hasNext()) {
String k = (String) keys.next();
if (key.equals(k)) {
json.put(key, newValue);
}
Object value = json.opt(k);
if (value != null && value instanceof JSONObject) {
replaceAll((JSONObject) value, key, newValue);
}
}
return json;
}