Reputation: 4509
I get the following JSON
{
_id: "5252fdf424f1e7fbf7000004",
address: "Calle 1000",
city: "Concepción",
created_at: "2013-10-07T18:31:19.375Z",
description: "",
name: "Joctos",
phone: "94967994",
updated_at: "2013-12-09T13:03:07.328Z",
happy_hour: {
active: false,
type: 1,
all_day: false,
start: "2013-12-17T03:30:00.000Z",
end: "2013-12-17T05:00:00.000Z"
}
}
And I think the Store object whose properties are the following
public class StoreModel {
@SerializedName("_id")
private String _id;
@SerializedName("address")
private String address;
@SerializedName("city")
private String city;
@SerializedName("created_at")
private String created_at;
@SerializedName("description")
private String description;
@SerializedName("name")
private String name;
@SerializedName("phone")
private String phone;
@SerializedName("updated_at")
private String updated_at;
@SerializedName("happy_hours")
private HappyHour happyHours;
//(GET AN SET)
And I have HappyHour object defined as follows
public class HappyHour {
@SerializedName("active")
private String active;
@SerializedName("type")
private double type;
@SerializedName("all_day")
private String all_day;
@SerializedName("start")
private String start;
@SerializedName("end")
private String end;
//(GET AND SET) }
But I get the following error when I run the program
at com.example.adicionalesprueba.StoreActivity$1.onItemClick(StoreActivity.java:127)
127: Log.i("Start", _response.get(position).getHappyHours().getStart() );
Upvotes: 0
Views: 82
Reputation: 8826
there is a typo in your object.
@SerializedName("happy_hour")
private HappyHour happyHours;
it should be hour instead of hours
Upvotes: 0
Reputation: 1468
In your json you have "happy_hour", and you are mapping it in your object as "happy_hours".
Change @SerializedName("happy_hours")
to @SerializedName("happy_hour")
.
Upvotes: 3