Re: [json-lib-user] Json and POJO Conversion
Brought to you by:
aalmiray
From: Andres A. <aal...@ya...> - 2007-07-05 18:30:56
|
Your welcome Pter, in fact when transforming from JSON to Java not only do = arrays will be=0Ahandled but arrays of primitives, muldimensional arrays an= d collections.=0AJust call JSONSerializer.toJava() after properly configuri= ng targetClass and classMap (if needed)=0A=0AYou may find more info at the = project site.=0A=0ACheers,=0AAndres=0A =0A---------------------------------= ----------=0Ahttp://jroller.com/page/aalmiray=0Ahttp://www.linkedin.com/in/= 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 understand recursion, we must first understan= d recursion.=0A=0A----- Mensaje original ----=0ADe: Petr V. <greatman787@ya= hoo.com>=0APara: Andres Almiray <aal...@ya...>; json-lib-user@lists.s= ourceforge.net=0AEnviado: jueves, 5 de julio, 2007 13:13:42=0AAsunto: Re: [= json-lib-user] Json and POJO Conversion=0A=0AThanks Andres, your reply was = very useful.=0A =0A I also found http://www.json.org/javadoc/org/json/JSONO= bject.html#JSONObject(java.lang.Object,%20java.lang.String[])=0A =0A but th= en I have to pass the attributes name of POJO object. =0A=0AI will try the = toJSON( ) method of JSONSerializer, would it be able to convert the collect= ions in POJO like arrays , maps, lists etc??=0A=0AThanks a lot once again, = =0A=0APetr=0A=0AAndres Almiray <aal...@ya...> wrote: Hi Petr,=0AI thi= nk you can find what you're looking for in net.sf.json.JSONSerializer=0AIt = will let you serialize a Java bean, map, array, collection into JSON and ba= ck, =0Ayou may specify a target class when converting back to Java or leave= it=0A blank,=0Athe result will be a DynaBean compatible with jakarta's bea= n-utils.=0A =0ACheers,=0AAndres=0A=0A=0A-----------------------------------= --------=0Ahttp://jroller.com/page/aalmiray=0Ahttp://www.linkedin.com/in/aa= lmiray=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 understand recursion, we must first understa= nd recursion.=0A=0A----- Mensaje original ----=0ADe: Petr V. <greatman787@y= ahoo.com>=0APara: jso...@li...=0AEnviado: jueves, 5 = de julio, 2007 12:46:43=0AAsunto:=0A [json-lib-user] Json and POJO Conversi= on=0A=0AHi,=0A=0AI have some POJO Objects and I need to convert them into J= SON Objects and vice versa. Is there Any API that provides this functionali= ty or I have to do manually conversion.=0A=0AI saw some sample code here = =0A=0Ahttp://dev2dev.bea.com/pub/a/2007/02/introduction-json.html=0A=0Awher= e they are converting address book entry (POJO) into JSON object manually a= nd then converting it into String. The next question is that can I make JSO= N object using that String again ?? Is there any efficient way to convert = pojo into json or vice versa, please let me know.=0A=0AThanks,=0A=0APetr V.= =0A =0ASick sense of humor? Visit Yahoo! TV's Comedy with an Edge t= o see what's on, when.=0A ----------------------------------------------= ---------------------------=0AThis SF.net email is sponsored by DB2 Express= =0ADownload DB2 Express C - the FREE version of DB2 express and take=0Acont= rol of your XML. No limits. Just data. Click to get it now.=0Ahttp://source= forge.net/powerbar/db2/=0A_______________________________________________= =0Ajson-lib-user mailing list=0Aj...@li...=0Ahttps= ://lists.sourceforge.net/lists/listinfo/json-lib-user=0A=0A=0A=0A=0A=0A=0A = Do You Yahoo!? La mejor conexi=F3n a Internet y 2GB extra a tu correo= por $100 al mes. http://net.yahoo.com.mx =0A =0A =0ABe a better Hear= tthrob. Get better relationship answers from someone who knows.=0AYahoo! An= swers - Check it out. =0A=0A=0A=0A=0A=0A=0A=09=0A=09=0A=09=09=0A___________= ________________________________________________ =0ADo You Yahoo!? =0ALa me= jor conexi=F3n a Internet y <b >2GB</b> extra a tu correo por $100 al mes. = http://net.yahoo.com.mx =0A |