//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);
所需的输出:{name:something1,status:up},{name:something2,status:down}...等