cari

Rumah  >  Soal Jawab  >  teks badan

android - 用Gson解析Json字符串数组的问题?

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

membalas semua(5)saya akan balas

  • 高洛峰

    高洛峰2017-04-17 16:20:58

    ArrayList

    balas
    0
  • 迷茫

    迷茫2017-04-17 16:20:58

    字符数组 String[]

    balas
    0
  • 天蓬老师

    天蓬老师2017-04-17 16:20:58

    两个类型都可以

    balas
    0
  • 怪我咯

    怪我咯2017-04-17 16:20:58

    /* 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;
    } }

    balas
    0
  • 高洛峰

    高洛峰2017-04-17 16:20:58

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

    balas
    0
  • Batalbalas