[Solved] Making JSON including JSONObject and JSONArray


This is what you are looking for,

public Object JSONData() throws Exception {
    JSONObject JSONObjectData = new JSONObject();
    JSONArray loomMachineArr = new JSONArray();

    loomMachineArr.add("Waterjet");
    loomMachineArr.add("Rapier");

    JSONArray LoomType= new JSONArray();
    LoomType.add("Dobby");
    LoomType.add("Crank");

    JSONObjectData.put("LoomMachine", loomMachineArr);
    JSONObjectData.put("LoomType", LoomType);

    return root; 
}

solved Making JSON including JSONObject and JSONArray