JSON例子
import java.io.FileWriter;import java.io.IOException;import org.json.simple.JSONArray;import org.json.simple.JSONObject; public class JsonSimpleExample { public static void main(String[] args) {JSONObject obj = new JSONObject();//json对象;obj.put("name", "rambo");obj.put("age", new Integer(100));JSONArray list = new JSONArray();//json数组;list.add("msg 1");list.add("msg 2");list.add("msg 3");obj.put("messages", list);try {FileWriter file = new FileWriter("F:\\demo\\test1.json");//建立一个文件file.write(obj.toJSONString());//把对象写到文件中file.flush();file.close();} catch (IOException e) {e.printStackTrace();}System.out.print(obj); }}?