android - 用Gson解析Json字符串数组的问题?
巴扎黑
巴扎黑 2017-04-17 16:18:58
0
5
582
    {
    "date":"2016-3-21",
    "info":{
    "kongtiao":[
    "较少开启",
    "您将感到很舒适,一般不需要开启空调。"
    ],
    "yundong":[
    "较不宜",
    "有降水,推荐您在室内进行健身休闲运动;若坚持户外运动,须注意携带雨具并注意避雨防滑。"
    ],
    "ziwaixian":[
    "最弱",
    "属弱紫外线辐射天气,无需特别防护。若长期在户外,建议涂擦SPF在8-12之间的防晒护肤品。"
    ],
    "ganmao":[
    "易发",
    "天冷空气湿度大,易发生感冒,请注意适当增加衣服,加强自我防护避免感冒。"
    ],
    "xiche":[
    "不宜",
    "不宜洗车,未来24小时内有雨,如果在此期间洗车,雨水和路上的泥水可能会再次弄脏您的爱车。"
    ]
    }
    }
    
    
它里面的值是[]字符串数组,那我要在Bean中用什么数据类型表示呢?
巴扎黑
巴扎黑

membalas semua(5)
小葫芦

ArrayList

迷茫

字符数组 String[]

Peter_Zhu

两个类型都可以

刘奇

/* date : 2016-3-21 * info :
{"kongtiao":["较少开启","您将感到很舒适,一般不需要开启空调。"],"yundong":["较不宜","有降水,推荐您在室内进行健身休闲运动;若坚持户外运动,须注意携带雨具并注意避雨防滑。"],"ziwaixian":["最弱","属弱紫外线辐射天气,无需特别防护。若长期在户外,建议涂擦SPF在8-12之间的防晒护肤品。"],"ganmao":["易发","天冷空气湿度大,易发生感冒,请注意适当增加衣服,加强自我防护避免感冒。"],"xiche":["不宜","不宜洗车,未来24小时内有雨,如果在此期间洗车,雨水和路上的泥水可能会再次弄脏您的爱车。"]}
*/

private String date; private InfoEntity info;

public void setDate(String date) {

this.date = date; }

public void setInfo(InfoEntity info) {

this.info = info; }

public String getDate() {

return date; }

public InfoEntity getInfo() {

return info; }

public static class InfoEntity {

private List<String> kongtiao;
private List<String> yundong;
private List<String> ziwaixian;
private List<String> ganmao;
private List<String> xiche;

public void setKongtiao(List<String> kongtiao) {
    this.kongtiao = kongtiao;
}

public void setYundong(List<String> yundong) {
    this.yundong = yundong;
}

public void setZiwaixian(List<String> ziwaixian) {
    this.ziwaixian = ziwaixian;
}

public void setGanmao(List<String> ganmao) {
    this.ganmao = ganmao;
}

public void setXiche(List<String> xiche) {
    this.xiche = xiche;
}

public List<String> getKongtiao() {
    return kongtiao;
}

public List<String> getYundong() {
    return yundong;
}

public List<String> getZiwaixian() {
    return ziwaixian;
}

public List<String> getGanmao() {
    return ganmao;
}

public List<String> getXiche() {
    return xiche;
} }
小葫芦

List<String> kongtiao = new ArrayList<>();

Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan