我正在使用下面的 JSON 字符串设计一个类。稍后我将使用 GSON 来读取 JSON 字符串。我在设计课程时遇到了麻烦。我尝试了太多版本,但都没有返回所需的结果。显然,我没有正确设计课程。我的应用程序代码非常复杂,所以我不能在这里粘贴。我只需要帮助来弄清楚我的班级设计,因为我已经尝试了太多次但没有成功。请放轻松,因为我对 Java 非常陌生。请。
JSON字符串:
{"info": [{"name":"Cineplex Outlets","storeCode":"3001","deptID":"5630","location":"Singapore","geography":"East","team_number":"Team 9",
"country":"United States","state":"Arizona","city":"Phoenix","address":{"storeAdd":["123,East Park St","1811 Fountain View","Pheoniz,
Arizona, 91210","United States"]},"passcode":"1001","telephone":{"landline":"1-818-502 8310"},"operationTimings":{"Monday":"10:00AM - 9:00PM",
"Tuesday":"10:00AM - 9:00PM","Friday":"10:00AM - 9:00PM","Wednesday":"10:00AM - 9:00PM","Thursday":"10:00AM - 9:00PM","Sunday":"11:00AM - 7:00PM",
"Saturday":"10:00AM - 9:00PM"},"links":{"myStInfo":"http://www.xyz","appointments":"http://abc",
"directions":"http://pqr"},"picture":{"http":"http://azy","https":"https://bbj"}}
Java 类:
public class MyClass {
private String name;
private String storeCode;
private Long deptID;
private String location;
private String geography;
private String team_number;
private String country;
private String state;
private String city;
private Address address;
public static class MyClassTest
{
private ArrayList<MyClass> info;
private String passcode;
private Telephone telephone;
private Hours operationTimings;
private StoreUrl links;
private StoreImage picture;
}
public static class Address
{
private ArrayList<String> storeAdd;
}
public static class Telephone
{
private String telephone;
}
public static class Hours
{
private String Monday;
private String Tuesday;
private String Friday;
private String Wednesday;
private String Thursday;
private String Sunday;
private String Saturday;
}
public static class StoreUrl
{
private URL myStInfo;
private URL appointments;
private URL directions;
}
public static class StoreImage
{
private URL http;
private URL https;
}
}