"showapi_res_error":"",
"showapi_res_id":"626fa35b0de3769f06a7fe49",
"showapi_res_code":0,
"showapi_fee_num":1,
"showapi_res_body":{
"ret_code":0,
"cityInfo":{
"c6":"yunnan",
"c5":"丽江",
"c4":"lijiang",
"c3":"丽江",
"c9":"中国",
"c8":"china",
"c7":"云南",
"c17":"+8",
"c16":"AZ9888",
"c1":"101291401",
"c2":"lijiang",
"c0":"530700",
"c11":"0888",
"longitude":100.222,
"c10":"2",
"latitude":26.903,
"c12":"674100",
"c15":"2394"
},
"f1":{
"night_weather_code":"08",
"day_weather":"小雨",
"night_weather":"中雨",
"jiangshui":"78%",
"air_press":"753.3hPa",
"night_wind_power":"0-3级 <5.4m/s",
"day_wind_power":"0-3级 <5.4m/s",
"day_weather_code":"07",
"sun_begin_end":"06:40|19:52",
"ziwaixian":"最弱",
"day_weather_pic":"http://app1.showapi.com/weather/icon/day/07.png",
"weekday":1,
"night_air_temperature":"4",
"day_wind_direction":"南风",
"day_air_temperature":"10",
"night_wind_direction":"南风",
"night_weather_pic":"http://app1.showapi.com/weather/icon/night/08.png",
"day":"20220502"
},
"f2":{
"night_weather_code":"07",
"day_weather":"小雨",
"night_weather":"小雨",
"jiangshui":"72%",
"air_press":"757.2hPa",
"night_wind_power":"0-3级 <5.4m/s",
"day_wind_power":"0-3级 <5.4m/s",
"day_weather_code":"07",
"sun_begin_end":"06:39|19:52",
"ziwaixian":"最弱",
"day_weather_pic":"http://app1.showapi.com/weather/icon/day/07.png",
"weekday":2,
"night_air_temperature":"7",
"day_wind_direction":"南风",
"day_air_temperature":"10",
"night_wind_direction":"南风",
"night_weather_pic":"http://app1.showapi.com/weather/icon/night/07.png",
"day":"20220503"
},
"f3":{
"night_weather_code":"07",
"day_weather":"小雨",
"night_weather":"小雨",
"jiangshui":"74%",
"air_press":"755.6hPa",
"night_wind_power":"0-3级 <5.4m/s",
"day_wind_power":"0-3级 <5.4m/s",
"day_weather_code":"07",
"sun_begin_end":"06:38|19:53",
"ziwaixian":"最弱",
"day_weather_pic":"http://app1.showapi.com/weather/icon/day/07.png",
"weekday":3,
"night_air_temperature":"5",
"day_wind_direction":"南风",
"day_air_temperature":"12",
"night_wind_direction":"西风",
"night_weather_pic":"http://app1.showapi.com/weather/icon/night/07.png",
"day":"20220504"
},
"now":{
"aqiDetail":{
"co":"0.6",
"num":"21",
"area":"丽江",
"so2":"6",
"o3":"76",
"no2":"6",
"quality":"优质",
"aqi":"24",
"pm10":"8",
"pm2_5":"4",
"o3_8h":"76",
"primary_pollutant":""
},
"weather_code":"01",
"temperature_time":"17:00",
"wind_direction":"东南风",
"wind_power":"2级",
"sd":"60%",
"aqi":"24",
"weather":"多云",
"weather_pic":"http://app1.showapi.com/weather/icon/day/01.png",
"rain":"0.0",
"temperature":"11"
},
"time":"20220502120000"
}
}
By this way
1 Like
谢谢啦(水字数水字数)
See here for some ideas
1 Like
Thank you
The issue could of course be that the JSON data is incorrectly formed/has bad syntax. Error 1105 means "Unable to decode the JSON text", which may well indicate that there is something wrong with it.
1 Like
Developers can use this online json validator to determine if they are using a 'properly' formatted json
3 Likes
Try when when web got text instead of when got file
3 Likes
Also, replace fileName with responseContent after you change the event.
3 Likes
I have tried it.It seems that the API response a file not a text.
标签2 showed "nooo".
So I think the next problem is taht how to read JSON from the file.
Response:
200
Date: Tue, 03 May 2022 11:02:05 GMT
Content-Type: application/json;charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Keep-Alive: timeout=25
Vary: Accept-Encoding
Access-Control-Allow-Headers: *
showapi_fee_num: 1
X-Ca-Request-Id: 3C9BCFB8-DC9B-4A74-BCB7-C3E88D543B83
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Max-Age: 1728000
{
"showapi_res_error": "",
"showapi_res_id": "62710bad0de3769e0691dcb6",
"showapi_res_code": 0,
"showapi_fee_num": 1,
"showapi_res_body": {"ret_code":0,"cityInfo":{"c6":"hunan","c5":"湘潭","c4":"xiangtan","c3":"湘潭","c9":"中国","c8":"china","c7":"湖南","c17":"+8","c16":"AZ9731","c1":"101250201","c2":"xiangtan","c0":"430300","c11":"0731","longitude":112.908,"latitude":27.867,"c10":"2","c12":"411100","c15":"64"},"f1":{"night_weather_code":"01","day_weather":"雾","night_weather":"多云","jiangshui":"31%","air_press":"1010.9hPa","night_wind_power":"0-3级 <5.4m/s","day_wind_power":"0-3级 <5.4m/s","day_weather_code":"18","sun_begin_end":"05:47|19:03","ziwaixian":"中等","day_weather_pic":"http://app1.showapi.com/weather/icon/day/18.png","weekday":2,"night_air_temperature":"16","day_air_temperature":"28","day_wind_direction":"北风","day":"20220503","night_weather_pic":"http://app1.showapi.com/weather/icon/night/01.png","night_wind_direction":"东南风"},"f2":{"night_weather_code":"00","day_weather":"多云","night_weather":"晴","jiangshui":"7%","air_press":"1009.7hPa","night_wind_power":"0-3级 <5.4m/s","day_wind_power":"0-3级 <5.4m/s","day_weather_code":"01","sun_begin_end":"05:46|19:03","ziwaixian":"中等","day_weather_pic":"http://app1.showapi.com/weather/icon/day/01.png","weekday":3,"night_air_temperature":"15","day_air_temperature":"28","day_wind_direction":"西南风","day":"20220504","night_weather_pic":"http://app1.showapi.com/weather/icon/night/00.png","night_wind_direction":"东南风"},"f3":{"night_weather_code":"01","day_weather":"多云","night_weather":"多云","jiangshui":"4%","air_press":"1006.3hPa","night_wind_power":"0-3级 <5.4m/s","day_wind_power":"0-3级 <5.4m/s","day_weather_code":"01","sun_begin_end":"05:45|19:04","ziwaixian":"中等","day_weather_pic":"http://app1.showapi.com/weather/icon/day/01.png","weekday":4,"night_air_temperature":"16","day_air_temperature":"30","day_wind_direction":"南风","day":"20220505","night_weather_pic":"http://app1.showapi.com/weather/icon/night/01.png","night_wind_direction":"东南风"},"now":{"aqiDetail":{"co":"0.5","num":"237","area":"湘潭","so2":"11","o3":"164","no2":"12","quality":"良好","aqi":"55","pm10":"36","pm2_5":"21","o3_8h":"161","primary_pollutant":"O3"},"weather_code":"00","temperature_time":"19:00","wind_direction":"西风","wind_power":"1级","sd":"43%","aqi":"55","weather":"晴","weather_pic":"http://app1.showapi.com/weather/icon/day/00.png","rain":"0.0","temperature":"25"},"time":"20220503180000"}
}
You are not getting a file, you are getting text content (json)
Can you please share the url you use to get json ?