Merge (Concat) Multiple JSONObjects in Java
If you want a new object with two keys, Object1 and Object2, you can do: JSONObject Obj1 = (JSONObject) jso1.get(“Object1”); JSONObject Obj2 = (JSONObject) jso2.get(“Object2”); JSONObject combined = new JSONObject(); combined.put(“Object1”, Obj1); combined.put(“Object2”, Obj2); If you want to merge them, so e.g. a top level object has 5 keys (Stringkey1, ArrayKey, StringKey2, StringKey3, StringKey4), I … Read more