Hi all~
I'm using json-lib 1.1 jdk13 version.
I don't know why json-lib serializes "[]" or "[12345]" string to array type.
test code :
public class JsonTest {
public static void main(String[] args) throws Exception
{
Test t = new Test();
t.setNickname("[12345]");
JSONObject obj = JSONObject.fromBean(t);
System.out.println(obj.toString());
}
public static class Test {
private String nickname;
public String getNickname() {
return nickname;
}
public void setNickname(String name) {
this.nickname = name;
}
}
}
the result is :
{"nickname":[12345]}
I expected that {"nickname":"[12345]"} would be printed.
Is there anyone who knows the reason?
|