//create the JSON Object to pass to the client
JSONObject object=new JSONObject();
//one instance
object.put("name","something2");
object.put("status", "up");
//second instance
object.put("name", "something2");
object.put("status", "down");
String json = object.toString();
response.getOutputStream().print(json);
System.out.println("JSON Contents: "+json);
Desired output: {name: something1, status: up}, {name: something2, status: down}... etc
You need to have JSONArray :
JSONArray jsonarray = new JSONArray(); jsonarray.add(object)...