I'm trying to convert a JSON string to a Java object used by Gson.
This is the json I get from webservice:
{"concurso":
{
"numero":1499,
"data_sorteio":"01\/06\/2013",
"dezenas":[8,22,26,33,37,54]
}
}
Here's my pojo class:
public class Concurso {
private int numero;
private String dataSorteio;
private int[] dezenas;
public Concurso() {
}
@Override
public String toString() {
return numero + " - " + dataSorteio;
}
}
Here's how I'm trying to convert String Json into Java
Gson gson = new Gson();
Concurso concurso = gson.fromJson(stringJson, Concurso.class);
Log.v("teste", concurso.toString());
Here is the output of LogCat
02-16 21:01:47.923 20796-20810/com.n3t0l0b0.blogspot.megasena.ativitys E/teste﹕ 0 - null