I have a json string like this:
String result={[{"id":"2","fullname":"Course 1"},{"id":"3","fullname":"Course 2"}]}
In java I wrote this code to decode that json string:
public class Courses {
public String id,name;
}
Gson gs = new Gson();
Type listType = new TypeToken<List<Courses>>(){}.getType();
List<Courses> listCourses= gs.fromJson(result, listType);
But I always receive error:
06-09 04:21:11.614: E/AndroidRuntime(449): Caused by: java.lang.IllegalStateException: This is not a JSON Array.
What am I wrong?
Thanks :)