JSONオブジェクトのデータを使用する必要がある場合、多くのコードを作成し、Pojoの思考を使用するために多くのコピーがあります。
java.ioexception.studection.json.json.jsonexcept;クラスとjsonオブジェクトは互いに変身します(Jackson-all-1.7.6.jar、jsoup -.5.2.jar) @param obj * @return */ public static <t> object jsontoobj(string jsonst、clus obj){t = null; } catch(Exception e){e.printstacktrace();} Return t jsonobject objecttojson(tolj)はjsonexception、ioexception {objectmapper = new objectMapper(); {Throw e;} new JsonObject(jsonstr);} public static void main(string [] args)thro jsonexception {jsonobject obj = new jsonobject(); 213 "); obj.put(" age "、27); jsonarray array = new jsonarray(); array.put(obj); obj = new jsonobject(); obj .put(" name "、" 214 "); obj.put( "arnay.put(obj); Student "、array); system.out.println(" objlist: "+objlist); dustentlist stulist =(sustentlist)j(objlist.tosttring()、susteantlist.class); system.out.println(" sudent: "+ stu); out.println( "+stulist); ############ これ);
上記は、この記事のすべての内容です。