Hi I already used GSON for parsing simple jsonobjects. But this time my response data is much complex. So I am struggling to parse that data.My data looks like :
[{"creator":"1", "users":[{"userName":"nilesh", "userAge":"25"},{"userName":"Me", "userAge":"25"}]},
{"creator":"2", "users":[{"userName":"nilesh", "userAge":"25"},{"userName":"Me", "userAge":"25"}]}
]
So I wrote one parsing class in following ways
public class UserData 
{
    @SerializedName("creator")
    public String creator;
    public List<Users> users;
    public static class Users
    {
        @SerializedName("userName")
        public String userName;
        @SerializedName("userAge")
        public String userAge;
    }
}
But this is not working. Am I doing some thing wrong need some help regarding this parsing. thank you.
I tried to parse like this :
Gson gson = new Gson();
UserData users = gson.fromJson(result, UserData.class);
And it gives me error like this :
 01-04 12:36:04.337: E/AndroidRuntime(15651): Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2
 
    