Re: [json-lib-user] Serializing "[]", "[12345]" problem
Brought to you by:
aalmiray
From: Andres A. <aal...@ya...> - 2007-07-13 14:24:05
|
Json-lib will try its best to transform any json-like literal into a JSONOb= ject or JSONArray,=0Abut in this case there is type information that must b= e taken into account and prevent that=0Atransformation. This is a bug, I'll= add it to the issue tracker.=0A=0AThanks for finding it!=0A=0ACheers,=0AAn= dres=0A =0A-------------------------------------------=0Ahttp://jroller.com= /page/aalmiray=0Ahttp://www.linkedin.com/in/aalmiray=0A--=0AWhat goes up, m= ust come down. Ask any system administrator.=0AThere are 10 types of people= in the world: Those who understand binary, and those who don't.=0ATo u= nderstand recursion, we must first understand recursion.=0A=0A----- Mensaje= original ----=0ADe: =EA=B9=80=EC=9D=91=EC=88=98 <sc...@gm...>=0APara= : jso...@li...=0AEnviado: viernes, 13 de julio, 2007= 3:48:50=0AAsunto: [json-lib-user] Serializing "[]", "[12345]" problem=0A= =0AHi all~=0A=0AI'm using json-lib 1.1 jdk13 version.=0AI don't know why js= on-lib serializes "[]" or "[12345]" string to array type.=0A=0Atest code := =0A=0Apublic class JsonTest {=0A public static void main(String[] args) = throws Exception=0A=0A {=0A Test t =3D new Test();=0A t.se= tNickname("[12345]");=0A JSONObject obj =3D JSONObject.fromBean(t);= =0A System.out.println(obj.toString());=0A }=0A =0A public = static class Test {=0A=0A private String nickname;=0A=0A publ= ic String getNickname() {=0A return nickname;=0A }=0A=0A = public void setNickname(String name) {=0A this.nickname = =3D name;=0A=0A }=0A }=0A}=0A=0Athe result is :=0A{"nickname":[12= 345]}=0A=0AI expected that {"nickname":"[12345]"} would be printed.=0A=0A= Is there anyone who knows the reason?=0A=0A--------------------------------= -----------------------------------------=0AThis SF.net email is sponsored = by DB2 Express=0ADownload DB2 Express C - the FREE version of DB2 express a= nd take=0Acontrol of your XML. No limits. Just data. Click to get it now.= =0Ahttp://sourceforge.net/powerbar/db2/=0A_________________________________= ______________=0Ajson-lib-user mailing list=0Aj...@li...urcefor= ge.net=0Ahttps://lists.sourceforge.net/lists/listinfo/json-lib-user=0A=0A= =0A=0A=0A=0A=0A=0A ______________________________________________ =0AT= odo sobre la Copa Am=C3=A9rica.=0AMantenete actualizado con las =C3=BAltima= s noticias sobre esta competencia en Yahoo! Deportes. =C2=A1Ent=C3=A9rate p= rimero! http://mx.sports.yahoo.com/futbol/copaamerica/index.html |