[json-lib-user] Serializing "[]", "[12345]" problem
Brought to you by:
aalmiray
From: <sc...@gm...> - 2007-07-13 08:48:57
|
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? |