I have a a JSON string as :
{
"personId": "person1",
"userId": "user1"
"details": [
{
"homeId": "home1",
"expireAt": "2023-03-08T15:17:04.506Z"
}
]
}
And
@Data
@Builder
public class MyResponse {
private String personId;
private String userId;
private List<Details> details;
}
@Data
@Builder
public class Details {
private String homeId;
private Instant expireAt;
}
I am trying to deserialize the JSON String
to MyResponse
as :
Gson().fromJson(string, MyResponse.class)
but getting the below expcetion for expireAt
field:
Expected BEGIN_OBJECT but was STRING at line 1 column 24 path $.details[0].expireAt
How can I resolve this ?