My class:
public class MyClass {
public HashMap<Integer, HashMap<String, PointFMP[] >> matchingPages;
public static class PointFMP{
public float x;
public float y;
}
}
My Json:
{
"matchingPages": {
"1": {
"Butter": [
{
"x": 16.23,
"y": 21.11
},
{
"x": 18.18,
"y": 26.67
}
],
"Cake": [
{
"x": 13.23,
"y": 21.11
}
]
},
"2": {
"Other value": [
{
"x": 41.98,
"y": 47.62
}
]
}
}
}
Parsing:
Gson gson = new GsonBuilder().create();
MyClass response = gson.fromJson(jsonString, MyClass.class);
My error:
11-29 12:56:47.017: W/System.err(8169): com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 11-29 12:56:47.022: W/System.err(8169): at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:176)
Any idea how to properly parse it?