Re: [json-lib-user] Square brackets in strings
Brought to you by:
aalmiray
From: Andres A. <aal...@ya...> - 2007-02-02 16:55:41
|
Hi Elizabeth,=0A=0AAnother user also registered this issue in the bug datab= ase,=0Ahttp://sourceforge.net/tracker/index.php?func=3Ddetail&aid=3D1650535= &group_id=3D171425&atid=3D857928=0AI'm currently looking at it, I'll see wh= at I can do :-)=0A=0ARegards,=0AAndres=0A =0A------------------------------= -------------=0Ahttp://jroller.com/page/aalmiray=0A--=0AWhat goes up, must = 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 understan= d recursion, we must first understand recursion.=0A=0A----- Mensaje origina= l ----=0ADe: Elizabeth Keogh <ek...@th...>=0APara: json-lib-use= r...@li...=0AEnviado: jueves, 1 de febrero, 2007 10:01:34=0AAs= unto: [json-lib-user] Square brackets in strings=0A=0ADear Json-lib devs,= =0A=0AThank you for your library! It's served us very well for the past few= months.=0A=0AUnfortunately my customers have started putting square bracke= ts just like the example below=0Ain the text they're sending us, with the e= xception that results (from info3).=0A=0A=0A public void testThatJsonIsN= otConfusedBySquareBrackets() {=0A HashMap<String, String> map =3D ne= w HashMap<String, String>();=0A map.put("address", "1 The flats [Upp= er floor]");=0A map.put("phoneNumber", "[+44] 582 401923");=0A = map.put("info1", "[Likes coffee]");=0A map.put("info2", "[Likes co= ffee] [Likes tea]");=0A map.put("info3", "[Likes coffee [but not wit= h sugar]]");=0A =0A JSONObject json =3D JSONObject.fromObject= (map);=0A }=0A=0A Due to the intrigues of multiple departments all using= this data, there's little to no chance of stopping them.=0A=0A=0A=0ACan yo= u help?=0A=0AThe problem seems as though it might be here, in JSONUtils:=0A= =0A public static boolean mayBeJSON( String string )=0A {=0A retur= n string !=3D null=0A && ("null".equalsIgnoreCase( string )=0A = || (string.startsWith( "[" ) && string.endsWith( "]" )) || = (string.startsWith( "{" ) && string.endsWith( "}" )));=0A }=0A=0AIs there= any chance please of fixing this, eg: by replacing the above with a regula= r expression that checks the String is truly JSON?=0A=0AMany thanks,=0ALiz.= =0A=0A--=0AElizabeth Keogh=0A...@th...=0Ahttp://www.livejournal.= com/users/sirenian=0A=0A=0A=0A---------------------------------------------= ----------------------------=0AUsing Tomcat but need to do more? Need to su= pport web services, security?=0AGet stuff done quickly with pre-integrated = technology to make your job easier.=0ADownload IBM WebSphere Application Se= rver v.1.0.1 based on Apache Geronimo=0Ahttp://sel.as-us.falkag.net/sel?cmd= =3Dlnk&kid=3D120709&bid=3D263057&dat=3D121642=0A___________________________= ____________________=0Ajson-lib-user mailing list=0Aj...@li...u= rceforge.net=0Ahttps://lists.sourceforge.net/lists/listinfo/json-lib-user= =0A=0A=0A=0A=0A=0A=0A=0A=09=0A=09=0A=09=09=0A______________________________= _____________________________ =0ADo You Yahoo!? =0ALa mejor conexi=F3n a In= ternet y <b >2GB</b> extra a tu correo por $100 al mes. http://net.yahoo.co= m.mx =0A |