Could you help me with this issue please. for example I have JSONEObject
{
\"glossary\": {
\"title\": \"example glossary\",
\"GlossDiv\": {
\"ti
You don't need to remove
before calling put
. JSONObject#put
will replace any existing value. Simply call
js.getJSONObject("glossary").getJSONObject("GlossDiv").put("seeds", "555");
But how to get to wanted key for one step?
You don't. You have a nested object tree. You must go through the full tree to reach your element. There might be a library out there that does this for you, but underneath it all, it will be traversing everything.