日期:2014-05-17 浏览次数:20666 次
class Test{
private String a;
public Test(String t){a = t;}
public String getA(){return a;}
public void setA(String t){a = t;}
}
class Main{
public static void main(String[] P){
Test t = new Test("''");
JSONObject x = JSONObject.fromObject(x); //{"a":"''"}
String s = x.toString(); //"{\"a\":\"''\"}"
x = JSONObject.fromObject(s); //{"a":""} 字符串中的单引号不见了……
}
}