What is the best way to combine (merge) two JSONObjects?
JSONObjects
JSONObject o1 = { \"one\": \"1\", \"two\": \"2\", \"three\": \"3\" } JSONObject
How about this:
Iterator iterator = json2.keys(); while(iterator.hasNext()){ String key = iterator.next().toString(); json1.put(key,map.optJSONObject(key)); }