Estoy tratando de analizar json de Android, pero me sale esta extraña excepción. Mis datos JSON esorg.json.JSON Excepción: Fin de la entrada en el carácter 0
{ "id": "1", "dueño": "1", "name": "seriedad", "Descripción": "es un festival", "hora_inicial":" 0000-00-00 00:00:00 "," end_time ":" 0000-00-00 00:00:00 "," lugar ":" vellore "," radio ":" 10 "," lat ":" 11 "," lng ":" 11 "," tipo ":" tipo "," propietario ":" dilip "," noofpolls ": 0," noofquizes ": 0," peopleattending ": 0," result ": true }
y en Android hago
JSONObject j =new JSONObject(response);
Event pst = gson.fromJson(j.toString(), Event.class);
me sale:
org.json.JSONException: end of input at character 0 of
¿Qué tiene de malo? Aquí está el código ...
RestClient client = new RestClient("http://192.168.1.3/services/events/"+eve.getName());
try {
Log.i("MY INFO", "calling boston");
client.Execute(RequestMethod.POST);
} catch (Exception e) {
e.printStackTrace();
}
String response = client.getResponse();
Log.i("MY INFO", response);
GsonBuilder gsonb = new GsonBuilder();
Gson gson = gsonb.create();
Event pst = null;
try {
JSONObject j =new JSONObject(response);
pst = gson.fromJson(j.toString(), Event.class);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Hola Rakon_188, también estoy teniendo el mismo problema ... pero lo estoy intentando de otra manera ... ¿pueden enviarme el código completo? – wolverine
Tuve el mismo problema aquí, pero parece que tuve que cambiar el mío a POST en lugar de GET. Parece que este error se produce si simplemente tiene el error, por lo que es posible que deba simplemente cambiar su llamada. – Silmarilos
gracias hombre: * ... –