一.先看看json的格式 { "weibo":[ //位置1 { "weibo_id": "1134", "uid": "150", "content": "#@[funk]cece请输入昵称#//@西西:乖乖", "ctime": "2013-02-05 16:34", "from": "2", "comment": "0", "transpond_id": "1119", "transpond": "0", "type": "1", "type_data": null, "from_data": false, "isdel": "0", "favorited": 0, "uname": "西西", "face": "http://www.nicemodel.net/data/uploads/avatar/150/middle.jpg", "transpond_data": {//位置2 "weibo_id": "1119", "uid": "150", "content": "[cake]hhhhjjkl fghhjkkkdffh我的我是啊?那", "ctime": "2013-01-30 13:40", "from": "2", "comment": "2", "transpond_id": "0", "transpond": "2", "type": "1", "type_data": { "thumburl": "http://www.nicemodel.net/data/uploads/2013/0130/13/small_5108b23a99660.jpg",//位置3 "thumbmiddleurl": "http://www.nicemodel.net/data/uploads/2013/0130/13/middle_5108b23a99660.jpg", "picurl": "http://www.nicemodel.net/data/uploads/2013/0130/13/5108b23a99660.jpg", "attach_id": 4279 }, "from_data": false, "isdel": "0", "uname": "西西", "face": "http://www.nicemodel.net/data/uploads/avatar/150/middle.jpg", "transpond_data": "", "timestamp": "1359524410", "friendtime": "01月30日 13:40", "favorited": 0 }, "timestamp": "1360053293",//位置4 "friendtime": "02月05日 16:34" }, ...... ] } 二、现在我们开始一点一点的去解析它 首先最外面的一层大括号{ ..... },这个应该使用JSONObject()去获取对象 1.通过数据交互获取String json数据 jsonStr; 2,将jsonStr转化为jsonObject对象 JSONObject jsonObject = new JSONObject(json); 3.接下来要一个getJSONArray()方法去获取,因为他是一个数组,[ ]之间的每一个{ ..... }代表数组的一个元素 4.JSONArray jsonArr = jsonObject.getJSONArray("weibo"); 获取位置2的数据就得需要: 获取数组中的第一组对象 5.JSONObject jsonArrObj = jsonArr.getJSONObject(0); // 这里的0代表的就是第一个{},以此类推 6.String transpondData = jsonArrObj.getString("transpond_data"); 7.JSONObject transpondDataObj = new JSONObject (transpondData); 获取位置3的数据就得需要: 8.String typedataStr = transpondDataObj.getString("type_data"); 9.JSONObject typeDataObj = new JSONObject (typedataStr); 10.String thumburl = typeDataObj.getString("thumburl"); 获取位置3的数据就得需要: String timestampStr = jsonArrObj.getString("timestamp"); 基本的json解析就分析完了