阅读背景:

如何使用net.sf.json在单个JSON对象中放置多个JSON实例。JSONObject图书馆

来源:互联网 
 //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);
 //create the JSON Object to pass to the client



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: