I have a json string in this format :
[
{
"key1": { "key1":"val1","key2":"val2" },
"key2": { "key1":"val1","key2":"val2" }
}
]
To parse it I created a java class :
class data {
String key;
List <content> listdata;
/* getter and setter for the attribute above */
...
}
Now I followed Gson documentation, and try to exract data :
Gson gson =new Gson();
data[] ints = gson.fromJson(MyjsonString, data[].class);
I get parsing error from Gson API, what I done wrong ?
java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1 path
[ { "key": [ "key1":"val1","key2":"val2" ]}, { "key": [ "key1":"val1","key2":"val2" ]}]