I have the following JSON structure:
[  
   {  
      "id":1,
      "name":"car",
      "elements":[  
         {  
            "id":1,
            "name":"price",
            "type":"textField",
            "constraints":"blablabla"
         },
         {  
            "id":2,
            "name":"color",
            "type":"textField",
            "constraints":"blablabla"
         },
         {  
            "id":3,
            "name":"images",
            "type":"image",
            "constraints":"blablabla"
         }
      ]
   }
]
And I have the following models:
public class Product {
    private Long id;
    private String name;
    @Expose
    private Element elements;
    public Product(Long id, String name, Element elements) {
        this.id = id;
        this.name = name;
        this.elements = elements;
    }
    public Long getId() {
        return id;
    }
    public String getName() {
        return name;
    }
    public Element getElements() {
        return elements;
    }
}
public class Element {
    private Long id;
    private String name;
    private String type;
    private String constraints;
    public Element(Long id, String name, String constraints, String type) {
        this.id = id;
        this.type=type;
        this.name = name;
        this.constraints = constraints;
    }
    public String getType() {
        return type;
    }
    public Long getId() {
        return id;
    }
    public String getName() {
        return name;
    }
    public String getConstraints() {
        return constraints;
    }
}
The Elements model is which I have problems, I am getting the following error: ERROR: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 35 path $[0].elements
How can I change the model to make it work? I tried to change the elements in Product class to JSONObject array but when I wanted to parse, it was empty.
 
     
     
     
     
    