I am having trouble parsing my JSON which i get from javascript. The format of JSON is this:
[{\"positions\":[{\"x\":50,\"y\":50},{\"x\":82,\"y\":50},{\"x\":
Define your classes and you will get everything you need using gson:
public class Class1 {
private int x;
private List<Class2> elements;
}
And the inner class:
public class Class2 {
private String str1;
private Integer int2;
}
Now you can parse a json string of the outer class just like that:
gson.fromJson(jsonString, Class1.class);
Your error while using Gson is that you try to parse a complex object in String
, which is not possible.