0

suppose that i have json object

"body" : -{
    "clinic" : -{
         "address" : -{
         "city" : Costa Mesa,
         "state" : CA      
          }

I want to add 'doctor' json object with its children as the same level as clinic in the given example.

saquib
  • 3
  • 1

1 Answers1

1

You just need to get the JSONObject of the body and put the doctor

 ((JSONObject) yourJson.get("body")).put("doctor", doctorJSON);
Seba López
  • 739
  • 1
  • 9
  • 18