android 如何解析如下json?
[{"stuId":"111","birthDate":"1999-08-08 00:00:00.0","stuName":"132123"},{"stuId":"112","birthDate":"1988-08-08 00:00:00.0","stuName":"111"}]

解决方案 »

  1.   

    这只是一个JSON的值,是一个JSON数组,不完整,
      

  2.   

    没用过json  要是我  直接读成String然后通过{} 和,以及:来拆分
      

  3.   


    String json_ = "[{'stuId':'111','birthDate':'1999-08-08 00:00:00.0','stuName':'132123'},{'stuId':'112','birthDate':'1988-08-08 00:00:00.0','stuName':'111'}]";
    private void parseJson(String json){
    try {
    JSONArray array = new JSONArray(json);
    for(int i=0;i<array.length();i++){
    JSONObject jsonObject = new JSONObject(array.getString(i));
    Log.i(TAG, "jsonObject.get('stuId') is:"+jsonObject.get("stuId"));
    Log.i(TAG, "jsonObject.get('birthDate') is:"+jsonObject.get("birthDate"));
    Log.i(TAG, "jsonObject.get('stuName') is:"+jsonObject.get("stuName"));
    }
    } catch (JSONException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    }