I am developing android application and I am using gson for parsing json response. My json responce looks like
[{"customerid":"abc","customername":"abc","location":null}
,{"customerid":"xyz","customername":"xyz","location":null}]
And class for parsing this response looks like :
public class CustomerInfo
{
@SerializedName("customerid")
public String customerid;
@SerializedName("customername")
public String customername;
@SerializedName("location")
public String location;
public CustomerInfo()
{}
}
I tried it in following way:
Gson gson = new Gson();
List<CustomerInfo> customers = (List<CustomerInfo>)gson.fromJson(result,CustomerInfo.class);
But its not working for me. How to do this. Need Help. Thank you.