Json error org.json.JSONException: Unterminated object at character [closed]

3

I can not find the error when I get this json

link

look at what's coming out in the log

12-19 13:39:53.589    9554-9564/json.exemplo.com.cortecabelo E/DEVMEDIA﹕ Erro no parsing do JSON
org.json.JSONException: Unterminated object at character 280 of { "AplicativosSugeridos" : [
{ "nome": "Chegou a Hora", "icone": "https://lh4.ggpht.com/IQ4km0WoDCIB-6ESZLzSYGYOae5X-ZDUKAdmB3D4_i7KF8HhVuWu65cpcxUOTDNH8tI=w300-rw" , "link": "https://play.google.com/store/apps/details?id=com.ilgner.chegouahora&hl=pt_BR },
{ "nome": "IMC Calc", "icone": "https://lh6.ggpht.com/VoNa54hKxdX6U47rrTlZ72ngPMFAcvTY38ugnifRsXSQJzAwprJDSZB25uBTHQoEbP8=w300-rw" , "link": "https://play.google.com/store/apps/details?id=com.ilgner.imc1&hl=pt_BR }
]
}
        at org.json.JSONTokener.syntaxError(JSONTokener.java:446)
        at org.json.JSONTokener.readObject(JSONTokener.java:390)
        at org.json.JSONTokener.nextValue(JSONTokener.java:96)
        at org.json.JSONTokener.readArray(JSONTokener.java:426)
        at org.json.JSONTokener.nextValue(JSONTokener.java:99)
        at org.json.JSONTokener.readObject(JSONTokener.java:381)
        at org.json.JSONTokener.nextValue(JSONTokener.java:96)
        at org.json.JSONObject.<init>(JSONObject.java:154)
        at org.json.JSONObject.<init>(JSONObject.java:171)
        at json.exemplo.com.cortecabelo.BaixarSugestoes.getSugestoes(BaixarSugestoes.java:70)
        at json.exemplo.com.cortecabelo.BaixarSugestoes.doInBackground(BaixarSugestoes.java:57)
        at json.exemplo.com.cortecabelo.BaixarSugestoes.doInBackground(BaixarSugestoes.java:27)
        at android.os.AsyncTask$2.call(AsyncTask.java:185)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
        at java.lang.Thread.run(Thread.java:1019)

Code

@Override
protected List<Sugestoes> doInBackground(String... params) {
    String urlString = params[0];
    HttpClient httpclient = new DefaultHttpClient();
    HttpGet httpget = new HttpGet(urlString);
    try {
        HttpResponse response = httpclient.execute(httpget);
        HttpEntity entity = response.getEntity();
        if (entity != null) {

            InputStream instream = entity.getContent();
            String json = toString(instream);
            instream.close();
            List<Sugestoes> sugestoes = getSugestoes(json);
            return sugestoes;
        }
    } catch (Exception e) {
        Log.e("DEVMEDIA", "Falha ao acessar Web service", e);
    }
    return null;
}

private List<Sugestoes> getSugestoes(String jsonString) {

    List<Sugestoes> sugestoes = new ArrayList<Sugestoes>();
    try {
        JSONObject trendLists = new JSONObject(jsonString);
        JSONArray jArray = trendLists.getJSONArray("AplicativosSugeridos");

        for (int i = 0; i < jArray.length(); i++) {
            Sugestoes sugestao = new Sugestoes();
            JSONObject json_data = jArray.getJSONObject(i);
            sugestao.nome = json_data.getString("nome");
            sugestao.link = json_data.getString("link");
            sugestao.icone = json_data.getString("icone");
            String nomeArquivo=baixarImagem(sugestao.icone, "imagemSugestao" + i);
            sugestao.icone = nomeArquivo;
            Banco banco = new Banco(context);
            if(banco.insertS(sugestao)){
                Log.d("Resultado S","Salvou");
            }else{
                Log.d("Resultado S","Nao Salvou");
            }
            sugestoes.add(sugestao);
        }

    } catch (JSONException e) {
        Log.e("DEVMEDIA", "Erro no parsing do JSON", e);
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    return sugestoes;
}
    
asked by anonymous 19.12.2014 / 16:44

1 answer

2

Your second link is not closed as a string.

"nome": "Chegou a Hora",
"icone":
"https://lh4.ggpht.com/IQ4km0WoDCIB-6ESZLzSYGYOae5X-ZDUKAdmB3D4_i7KF8HhVuWu65cpcxUOTDNH8tI=w300-rw",
"link":
"https://play.google.com/store/apps/details?id=com.ilgner.chegouahora&hl=pt_BR  <- Cade o fechamento das aspas!?
    
19.12.2014 / 16:55