I am new to Java and JSON and I'm trying to parse the following JSON using GSON. However, I am having a problem in that I don't have any errors but the object is just empty.
{
"pac": [
{
"customerName": "TEST"
}
]
}
This class is what im trying to make an object of:
public class customer{
/** The customer name. */
private String customerName;
/**
* Gets the customer name.
*
* @return the customer name
*/
public String getCustomerName() {
return customerName;
}
/**
* Sets the customer name.
*
* @param customerName the new customer name
*/
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
I'm using this to try and parse:
Gson gson = new Gson();
customer i = gson.fromJson(jsonFile, customer.class);
I would appriciate if you guys had any tips.