I am facing this error in parsing json data
Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2
I could'nt find the solution. My json data is :
{
"user": [
{
"email": "[email protected]",
"firstName": "Wijden",
"id": "1",
"lastName": "User"
}, {
"email": "[email protected]",
"firstName": "Sample",
"id": "2",
"lastName": "User"
}, {
"email": "[email protected]",
"firstName": "Ingenieur",
"id": "3",
"lastName": "User"
}
]
}
And this is how I did it :
Type type = new TypeToken<List<WorkItem>>() { }.getType();
List<WorkItem> workitems = (List<WorkItem>) new Gson().fromJson(resultat, type);
I would greatly appreciate it if you can help me solve tnis problem. Thanks in advance