I have local weather api which gives me JSON output. It have current weather node and another node for 7 days forecast. Below is the JSON output
Now I created flow as below
My SharePoint Custom list structure
I am looking for any suggestion to improve my flow or solve my issue. Please help
Solved! Go to Solution.
Hi @milind,
Forecastda is an array, and the dates inside are all corresponding to index.
You could use array[index] to arrange the elements in the array in the corresponding fields in order.
Like:
I used the data you provided, parsed JSON data, and got the data from the first day of the forecast.
Date:
body('Parse_JSON')?['forecast']?['forecastday'][0]['date']
High temperature:
body('Parse_JSON')?['forecast']?['forecastday'][0]['day']['maxtemp_c']
Low temperature:
body('Parse_JSON')?['forecast']?['forecastday'][0]['day']['mintemp_c']
Image reference:
By analogy, to get the data for the next day, just change the index.
Please take a try.
Best Regards,
Hi @milind,
Could you provide the specific content of the JSON output? An example of data for a set of JSON output content.
Because the content below the forecast has not been expanded, I don't know how its format and basic content are.
If you could provide examples of data in the same format, we are more convenient to test here.
Please provide more details.
Best Regards,
Below is original JSON data
{"location":{"name":"Kuwait City","region":"Al Kuwayt","country":"Kuwait","lat":29.37,"lon":47.96,"tz_id":"Asia/Kuwait","localtime_epoch":1548246586,"localtime":"2019-01-23 15:29"},"current":{"last_updated_epoch":1548245725,"last_updated":"2019-01-23 15:15","temp_c":16.0,"temp_f":60.8,"is_day":1,"condition":{"text":"Sunny","icon":"//cdn.apixu.com/weather/64x64/day/113.png","code":1000},"wind_mph":10.5,"wind_kph":16.9,"wind_degree":50,"wind_dir":"NE","pressure_mb":1017.0,"pressure_in":30.5,"precip_mm":0.0,"precip_in":0.0,"humidity":39,"cloud":0,"feelslike_c":16.0,"feelslike_f":60.8,"vis_km":10.0,"vis_miles":6.0,"uv":5.0},"forecast":{"forecastday":[{"date":"2019-01-23","date_epoch":1548201600,"day":{"maxtemp_c":18.9,"maxtemp_f":66.0,"mintemp_c":10.9,"mintemp_f":51.6,"avgtemp_c":15.6,"avgtemp_f":60.1,"maxwind_mph":7.4,"maxwind_kph":11.9,"totalprecip_mm":0.0,"totalprecip_in":0.0,"avgvis_km":17.5,"avgvis_miles":10.0,"avghumidity":34.0,"condition":{"text":"Partly cloudy","icon":"//cdn.apixu.com/weather/64x64/day/116.png","code":1003},"uv":4.9},"astro":{"sunrise":"06:42 AM","sunset":"05:19 PM","moonrise":"07:57 PM","moonset":"08:28 AM"}},{"date":"2019-01-24","date_epoch":1548288000,"day":{"maxtemp_c":19.3,"maxtemp_f":66.7,"mintemp_c":18.1,"mintemp_f":64.6,"avgtemp_c":18.4,"avgtemp_f":65.1,"maxwind_mph":9.4,"maxwind_kph":15.1,"totalprecip_mm":0.0,"totalprecip_in":0.0,"avgvis_km":20.0,"avgvis_miles":12.0,"avghumidity":47.0,"condition":{"text":"Partly cloudy","icon":"//cdn.apixu.com/weather/64x64/day/116.png","code":1003},"uv":5.3},"astro":{"sunrise":"06:41 AM","sunset":"05:19 PM","moonrise":"09:04 PM","moonset":"09:12 AM"}},{"date":"2019-01-25","date_epoch":1548374400,"day":{"maxtemp_c":21.8,"maxtemp_f":71.2,"mintemp_c":18.0,"mintemp_f":64.4,"avgtemp_c":19.5,"avgtemp_f":67.0,"maxwind_mph":16.3,"maxwind_kph":26.3,"totalprecip_mm":0.0,"totalprecip_in":0.0,"avgvis_km":19.7,"avgvis_miles":12.0,"avghumidity":72.0,"condition":{"text":"Partly cloudy","icon":"//cdn.apixu.com/weather/64x64/day/116.png","code":1003},"uv":5.6},"astro":{"sunrise":"06:41 AM","sunset":"05:20 PM","moonrise":"10:08 PM","moonset":"09:53 AM"}},{"date":"2019-01-26","date_epoch":1548460800,"day":{"maxtemp_c":20.5,"maxtemp_f":68.9,"mintemp_c":19.2,"mintemp_f":66.6,"avgtemp_c":19.2,"avgtemp_f":66.6,"maxwind_mph":11.9,"maxwind_kph":19.1,"totalprecip_mm":0.0,"totalprecip_in":0.0,"avgvis_km":19.7,"avgvis_miles":12.0,"avghumidity":86.0,"condition":{"text":"Partly cloudy","icon":"//cdn.apixu.com/weather/64x64/day/116.png","code":1003},"uv":5.8},"astro":{"sunrise":"06:40 AM","sunset":"05:21 PM","moonrise":"11:10 PM","moonset":"10:30 AM"}},{"date":"2019-01-27","date_epoch":1548547200,"day":{"maxtemp_c":23.7,"maxtemp_f":74.7,"mintemp_c":21.3,"mintemp_f":70.3,"avgtemp_c":20.9,"avgtemp_f":69.7,"maxwind_mph":25.7,"maxwind_kph":41.4,"totalprecip_mm":0.0,"totalprecip_in":0.0,"avgvis_km":19.7,"avgvis_miles":12.0,"avghumidity":65.0,"condition":{"text":"Partly cloudy","icon":"//cdn.apixu.com/weather/64x64/day/116.png","code":1003},"uv":3.8},"astro":{"sunrise":"06:40 AM","sunset":"05:22 PM","moonrise":"No moonrise","moonset":"11:08 AM"}},{"date":"2019-01-28","date_epoch":1548633600,"day":{"maxtemp_c":21.8,"maxtemp_f":71.2,"mintemp_c":16.2,"mintemp_f":61.2,"avgtemp_c":20.9,"avgtemp_f":69.7,"maxwind_mph":25.1,"maxwind_kph":40.3,"totalprecip_mm":4.6,"totalprecip_in":0.18,"avgvis_km":17.6,"avgvis_miles":10.0,"avghumidity":48.0,"condition":{"text":"Patchy rain possible","icon":"//cdn.apixu.com/weather/64x64/day/176.png","code":1063},"uv":5.0},"astro":{"sunrise":"06:40 AM","sunset":"05:23 PM","moonrise":"12:10 AM","moonset":"11:45 AM"}},{"date":"2019-01-29","date_epoch":1548720000,"day":{"maxtemp_c":20.1,"maxtemp_f":68.2,"mintemp_c":18.6,"mintemp_f":65.5,"avgtemp_c":18.3,"avgtemp_f":64.9,"maxwind_mph":15.2,"maxwind_kph":24.5,"totalprecip_mm":0.7,"totalprecip_in":0.03,"avgvis_km":17.5,"avgvis_miles":10.0,"avghumidity":55.0,"condition":{"text":"Patchy rain possible","icon":"//cdn.apixu.com/weather/64x64/day/176.png","code":1063},"uv":4.0},"astro":{"sunrise":"06:39 AM","sunset":"05:24 PM","moonrise":"01:09 AM","moonset":"12:23 PM"}}]}}
Hi @milind,
Forecastda is an array, and the dates inside are all corresponding to index.
You could use array[index] to arrange the elements in the array in the corresponding fields in order.
Like:
I used the data you provided, parsed JSON data, and got the data from the first day of the forecast.
Date:
body('Parse_JSON')?['forecast']?['forecastday'][0]['date']
High temperature:
body('Parse_JSON')?['forecast']?['forecastday'][0]['day']['maxtemp_c']
Low temperature:
body('Parse_JSON')?['forecast']?['forecastday'][0]['day']['mintemp_c']
Image reference:
By analogy, to get the data for the next day, just change the index.
Please take a try.
Best Regards,
Hi @v-bacao-msft - how did you take the values from the variables and create the items for the sharepoint list?
User | Count |
---|---|
87 | |
37 | |
25 | |
13 | |
12 |
User | Count |
---|---|
116 | |
55 | |
36 | |
23 | |
21 |