If you are using the JsonObject class it is immutable
So i believe you have to duplicate the object and change the value like this:
JSONObject object=new JSONObject(jsonstring);
JSONObject childobject=object.getJSONObject("XXXX");
JSONObject modifiedjson=new JSONObject();
modifiedjson.put("type",childobject.get("type"));
modifiedjson.put("value","newvalue"); // Add new value of XXXX here