i have this code:
Carrera userRecived = null;
HttpClient httpclient;
HttpGet httpget;
HttpResponse response;
HttpEntity entity;
/*Call Json service and Unserialize with Gson into the class*/
try{
httpclient = new DefaultHttpClient();
httpget = new HttpGet(Url);
response = httpclient.execute(httpget);
entity = response.getEntity();
String result= EntityUtils.toString(entity);
Gson gson = new Gson();
userRecived = gson.fromJson(result, Carrera.class);
}catch(Exception error){throw new Error("Error en el get -- "+error.toString());}
My problem is the next error:
03-08 19:07:42.899: E/AndroidRuntime(959): java.lang.Error: Error en el getcom.google.gson.JsonParseException: Expecting array but found object: com.jorgechu.circuitlacostera.Objetos.Carrera@405852d0
I waiting result from php webservice, the result may next JSON:
[{"Codigo":"1","Denominacion":"Popular de Xativa","Imagen":"1231313","Poblacion":"Xativa","Lugar":"Valencia","Fecha":"11 de Noviembre de 2012","Hora":"17:00","Descripcion":"para probar","Reglamento":"http:\/\/www.google.es","Kilometros":"21"}]
And I have a object Carrera where store this information.
I hope somepeople help me.
Thank you.
change:
to: