sinat_24423367 2015-08-17 03:51 采纳率: 83.3%
浏览 1780
已采纳

这个json数据如何用gson解析?

{
errNum: 0,
errMsg: "success",
retData: {
city: "北京",
cityid: "101010100",
today: {
date: "2015-08-03",
week: "星期一",
curTemp: "28℃",
aqi: "92",
fengxiang: "无持续风向",
fengli: "微风级",
hightemp: "30℃",
lowtemp: "23℃",
type: "阵雨",
index: [
{
name: "感冒指数",
code: "gm",
index: "",
details: "各项气象条件适宜,发生感冒机率较低。但请避免长期处于空调房间中,以防感冒。",
otherName: ""
},
{
code: "fs",
details: "属中等强度紫外辐射天气,外出时应注意防护,建议涂擦SPF指数高于15,PA+的防晒护肤品。",
index: "中等",
name: "防晒指数",
otherName: ""
},
{
code: "ct",
details: "天气炎热,建议着短衫、短裙、短裤、薄型T恤衫等清凉夏季服装。",
index: "炎热",
name: "穿衣指数",
otherName: ""
},
{
code: "yd",
details: "有降水,推荐您在室内进行低强度运动;若坚持户外运动,须注意选择避雨防滑并携带雨具。",
index: "较不宜",
name: "运动指数",
otherName: ""
},
{
code: "xc",
details: "不宜洗车,未来24小时内有雨,如果在此期间洗车,雨水和路上的泥水可能会再次弄脏您的爱车。",
index: "不宜",
name: "洗车指数",
otherName: ""
},
{
code: "ls",
details: "有降水,不适宜晾晒。若需要晾晒,请在室内准备出充足的空间。",
index: "不宜",
name: "晾晒指数",
otherName: ""
}
]
},
forecast: [
{
date: "2015-08-04",
week: "星期二",
fengxiang: "无持续风向",
fengli: "微风级",
hightemp: "32℃",
lowtemp: "23℃",
type: "多云"
},
{
date: "2015-08-05",
week: "星期三",
fengxiang: "无持续风向",
fengli: "微风级",
hightemp: "30℃",
lowtemp: "23℃",
type: "多云"
},
{
date: "2015-08-06",
week: "星期四",
fengxiang: "无持续风向",
fengli: "微风级",
hightemp: "29℃",
lowtemp: "24℃",
type: "雷阵雨"
},
{
date: "2015-08-07",
week: "星期五",
fengxiang: "无持续风向",
fengli: "微风级",
hightemp: "30℃",
lowtemp: "24℃",
type: "多云"
}
],
history: [

        {
            date: "2015-07-31",
            week: "星期五",
            aqi: "52",
            fengxiang: "无持续风向",
            fengli: "微风级",
            hightemp: "高温 29℃",
            lowtemp: "低温 22℃",
            type: "多云"
        },
        {
            date: "2015-08-01",
            week: "星期六",
            aqi: null,
            fengxiang: "南风",
            fengli: "微风级",
            hightemp: "高温 35℃",
            lowtemp: "低温 26℃",
            type: "多云"
        }
    ]
}

}

  • 写回答

8条回答 默认 最新

  • JPF1024 2015-08-17 06:32
    关注
     public class WeatherRetData {
    private String city;
    private String cityid;
    private List<WeatherResult> today;//这样.-----------------------------
    private List<Forecast > forecast; //这样--------------------------------
    private List<History> history;//
    ......get/set......
    }
    

    参考这个方式改一下,然后在试试

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(7条)

报告相同问题?

悬赏问题

  • ¥50 opencv4nodejs 如何安装
  • ¥15 adb push异常 adb: error: 1409-byte write failed: Invalid argument
  • ¥15 nginx反向代理获取ip,java获取真实ip
  • ¥15 eda:门禁系统设计
  • ¥50 如何使用js去调用vscode-js-debugger的方法去调试网页
  • ¥15 376.1电表主站通信协议下发指令全被否认问题
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥15 复杂网络,变滞后传递熵,FDA
  • ¥20 csv格式数据集预处理及模型选择
  • ¥15 部分网页页面无法显示!