Parsing JSON from url with exception: Error parsing data org.json.JSONException: Unterminated array at character 115

后端 未结 3 1383
被撕碎了的回忆
被撕碎了的回忆 2020-12-22 05:59

I\'m parsing this url and I\'ve got an exception and don\'t know how to skip it over... I need to get only names of 100 the most popular apps. There is key \"im:name\" and i

3条回答
  •  有刺的猬
    2020-12-22 06:21

    First You make a call get the result into a string called json. Then You have to convert the string into Json object

              String json = null;  
            JSONObject jsonObj = null;  JSONObject feedsObject = null;
    
    
         json = jParser.getJSONFromUrl(jsonStringUrl);
           if (json != null) {
        try {
             jsonObj = new JSONObject(json);
    
            feedObject = jsonObj.getJSONObject("feed");
    

    For a better understanding visit http://json.parser.online.fr/beta/ and paste your json data there. On the right you have a settings button---> show types You can find what are objects, strings and arrays

    See the image below. You were trying get a an object not an array

    enter image description here

提交回复
热议问题