以下の 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;
}
}