Re: [json-lib-user] Json and POJO Conversion
Brought to you by:
aalmiray
From: Petr V. <gre...@ya...> - 2007-07-05 18:13:50
|
Thanks Andres, your reply was very useful. I also found http://www.json.org/javadoc/org/json/JSONObject.html#JSONObject(java.lang.Object,%20java.lang.String[]) but then I have to pass the attributes name of POJO object. I will try the toJSON( ) method of JSONSerializer, would it be able to convert the collections in POJO like arrays , maps, lists etc?? Thanks a lot once again, Petr Andres Almiray <aal...@ya...> wrote: Hi Petr, I think you can find what you're looking for in net.sf.json.JSONSerializer It will let you serialize a Java bean, map, array, collection into JSON and back, you may specify a target class when converting back to Java or leave it blank, the result will be a DynaBean compatible with jakarta's bean-utils. Cheers, Andres ------------------------------------------- http://jroller.com/page/aalmiray http://www.linkedin.com/in/aalmiray -- What goes up, must come down. Ask any system administrator. There are 10 types of people in the world: Those who understand binary, and those who don't. To understand recursion, we must first understand recursion. ----- Mensaje original ---- De: Petr V. <gre...@ya...> Para: jso...@li... Enviado: jueves, 5 de julio, 2007 12:46:43 Asunto: [json-lib-user] Json and POJO Conversion Hi, I have some POJO Objects and I need to convert them into JSON Objects and vice versa. Is there Any API that provides this functionality or I have to do manually conversion. I saw some sample code here http://dev2dev.bea.com/pub/a/2007/02/introduction-json.html where they are converting address book entry (POJO) into JSON object manually and then converting it into String. The next question is that can I make JSON object using that String again ?? Is there any efficient way to convert pojo into json or vice versa, please let me know. Thanks, Petr V. --------------------------------- Sick sense of humor? Visit Yahoo! TV's Comedy with an Edge to see what's on, when. ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ json-lib-user mailing list jso...@li... https://lists.sourceforge.net/lists/listinfo/json-lib-user --------------------------------- Do You Yahoo!? La mejor conexión a Internet y 2GB extra a tu correo por $100 al mes. http://net.yahoo.com.mx --------------------------------- Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out. |