This is a common method in Java, the example is as follows, copied from: http://www.oschina.net/code/snippet_176897_7317
Package Com. Practice. JSON; Import Org. JSON. jsonarray; Import Org. JSON. jsonexception; Import Org. JSON. jsonobject; Import Android. App. activity; Import Android. OS. Bundle; Import Android. util. log; Public Class Jsondemo Extends Activity { /* * JSON parsing example. Str stores JSONCodeThe parsed data is output in logcat. */ String tag = "JSON message" ; @ Override Public Void Oncreate (bundle savedinstancestate ){ Super . Oncreate (savedinstancestate); setcontentview (R. layout. Main); detectjson ();} Private Void Detectjson () {string Str = "{" + "\" Date \ ": \" 2011-06-06 \ "," + // Like is jsonobject "\" Like \ ": {" + "\" Name \ ": \" Garnett \ "," + "\" height \ ": \" 2. 11cm \", "+" \ "Age \": 35 "+"}, "+ // Likelist is a jsonobject. "\" Likelist \ ":" + "{\" list \ ":" + "[" + // This is also jsonobject. "{" + "\" Name \ ": \" Rose \ "," + "\" height \ ": \" 190cm \", "+" \ "Age \": 23 "+"}, "+ // This is also jsonobject. "{" + "\" Name \ ": \" Kobe \ "," + "\" height \ ": \" 198cm \", "+" \ "Age \": 33 "+"} "+"] "+"} "+ "}" ; Try {Jsonobject datajson =New Jsonobject (STR); log. D (TAG, datajson. getstring ( "Date" ); Jsonobject nbajson = Datajson. getjsonobject ("like" ); Log. D (TAG, nbajson. getstring ( "Name" ); Log. D (TAG, nbajson. getstring ( "Height" ); Log. D (TAG, nbajson. Get ( "Age" ). Tostring (); jsonobject listjson = Datajson. getjsonobject ("likelist" ); Jsonarray arrayjson = Listjson. getjsonarray ("list"); For ( Int I = 0; I <arrayjson. Length (); I ++ ) {Jsonobject tempjson = Arrayjson. optjsonobject (I); log. D (TAG, tempjson. getstring ( "Name" ); Log. D (TAG, tempjson. getstring ( "Height" ); Log. D (TAG, tempjson. getstring ( "Age" ). Tostring ());}} Catch (Jsonexception e) {system. Out. println ( "Something wrong ..." ); E. printstacktrace ();}}}