如何消除Open Weather Map API提供的JSON天气预报的歧义?

时间:2015-08-05 12:23:03

标签: android json api weather weather-api

与Yahoo Weather API不同,Open Weather(特别是JSON)的天气预报响应中不包含有关日期和日期的详细信息。我只是得到一份预测数据清单。我怎么知道哪个预测对应哪一天?该清单是否包含特定天数(连续7天?)的预测,包括今天及以后,或者是明天还是以后?

以下是每日天气预报文档的链接: http://openweathermap.org/forecast16

这是一个用于查看JSON响应的JSON编辑器: http://www.jsoneditoronline.org/

以下是一个示例回复:

  

{"城市" {" ID":1172451,"名称":"拉合尔"" COORD&#34 ;:{" LON":74.343613," LAT":31.549721}"国家":" PK""人口&# 34;:0},"鳕鱼":" 200""消息":0.0099," CNT":5,"列表":[{&#34峰; dt":1438758000,"温度" {"天":31.45"分钟":26.37, " MAX":31.45"夜间":26.37"前夕":30.71"早晨":31.45}"压力& #34;:984.75"湿度" 79"天气":[{" ID":801,"主":&# 34;云""描述":"几   云""图标":" 02D"}],"速度":3.83,"度" 119&#34 ;云" 20},{&#34峰; dt":1438844400,"温度" {"天":26.39"分钟" :24.36" MAX":29.98"夜间":25.71"前夕":29.93"早晨":25.13},&# 34;压力":986.81"湿度":100,"天气":[{" ID":502,"主" :"雨""描述":"重   强度   雨""图标":" 10D"}],"速度":3.22,"度":78,&#34 ;云":56,"雨":28.51},{&#34峰; dt":1438930800,"温度" {"天" :31.44"分钟":25.78" MAX":33.25"夜间":27.22"前夕":33.25&#34 ;早晨":25.78}"压力":988.04"湿度" 85"天气":[{" ID" :501,"主":"雨""描述":"中等   雨""图标":" 10D"}],"速度":2.11,"度" 125&#34 ;云":20,"雨":3.22},{&#34峰; dt":1439017200,"温度" {"天" :28.41"分钟":25.8," MAX":31.69"夜间":27.59"前夕":31.69&#34 ;早晨":25.8}"压力":990.43"湿度":90,"天气":[{" ID" :501,"主":"雨""描述":"中等   雨""图标":" 10D"}],"速度":2.52,"度" 87&#34 ;云" 92"雨":7.27},{&#34峰; dt":1439103600,"温度" {"天" :31.35"分钟":26.23" MAX":33.56"夜间":27.29"前夕":31.68&#34 ;早晨":26.23}"压力":987.94"湿度":81,"天气":[{" ID" :500,"主":"雨""描述":"光   雨""图标":" 10D"}],"速度":1.51,"度" 99&#34 ;云":44,"雨":2.59}]}

1 个答案:

答案 0 :(得分:1)

如果我没错,则dt是当天的时间戳。 你可以看一下Weatherlib。它是我编写的一个开源库,用于解析OWM数据和其他天气提供者。 希望它可以帮到你。