I want to parse a JSON Response through GSON in android, for example
{
"adult": false,
"budget": 63000000,
"spoken_languages": [
{
"iso_639_1": "en",
"name": "English"
}
],
}
first class for this
public Detail parseDetailResponse(InputStream json) {
Gson gson = new Gson();
Reader reader=new InputStreamReader(json);
Detail handle = gson.fromJson(reader, Detail.class);
return handle;
}
class for parsing this
public class Detail implements Serializable{
private static final long serialVersionUID = -6814886315783830255L;
@SerializedName("adult")
public boolean Adult;
@SerializedName("spoken_languages")
public lang[] Languages;
}
My lang class
public class lang implements Serializable{
private static final long serialVersionUID = -6814886315783830255L;
@SerializedName("name")
public String Name;
}
now i want the value of lang.name, but it gives null pointer exception.. pls help How i am getting this value...