I work with Firebase for my app and I've got one error. Json which I take from Firebase usual looks like this:
"post": {
"title": "title",
"date": 1459423087916,
"comments": [
{
"text": "sometext"
},
{
"text": "sometext"
}
]
}
but sometimes it looks like this:
"post": {
"title": "title",
"date": 1459423087916
}
And I always take this error:
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token
Is there any way to handle it?
My Object model class:
public class Post {
private String title;
private long date;
private List<Comment> comments;
// constructor, getters and setters
}