How to parse complex JSON file in android

后端 未结 2 685
醉酒成梦
醉酒成梦 2020-12-03 16:34

I need to parse this json string

 {
\"results\": {
    \"result\": [
        {
            \"cover\": \"http://ia.media-imdb.com/images/M/MV5BMjMyOTM4MDMxNV5         


        
2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-03 17:21

    You can try to Parse Current Json String as:

    JSONObject response = new JSONObject(respString);
    JSONObject jsonobjresults = response.getJSONObject("results");
    JSONArray resultArray = jsonobjresults.getJSONArray("result");
    Map> 
                           mapoflisp = new HashMap>();  
    ArrayList listofitem;
    for(int i=0; i();
        // Add items in List
        listofitem.add(item.getString("cover"));
        listofitem.add(item.getString("title"));
        listofitem.add(item.getString("year"));
        listofitem.add(item.getString("director"));
        listofitem.add(item.getString("rating"));
        listofitem.add(item.getString("details"));
    
         //add list to Map
        mapoflisp.put(i,listofitem); 
    
        // your code here...
     }  
    

提交回复
热议问题