Java tutorial
//package com.java2s; //License from project: Open Source License import org.json.JSONException; import org.json.JSONObject; import java.util.Iterator; public class Main { static void appendJson(JSONObject json, JSONObject jsonToAppend) { if (jsonToAppend == null) return; try { Iterator<String> it = jsonToAppend.keys(); while (it.hasNext()) { String key = it.next(); json.put(key, jsonToAppend.get(key)); } } catch (JSONException e) { e.printStackTrace(); } } }