public void demoJson2()
{
try
{
JSONObject obj = new JSONObject();
obj.put("attribute", "foo");
obj.put("number", new Double(100.959));
String jsonStr = obj.serialize(true);
System.out.println(jsonStr);
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
|