cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

JSON - Adding Multiple rows in SharePoint Custom List in one row

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

JSON.png

Now I created flow as below

  1. Created HTTP action to get API in JSON
  2. Then, I created  JSON Parser by providing schema 
  3. Then, I created COMPOSE and selected current node from the JSON Parser output
  4. Then, I created Create Item for SharePoint and added current weather data into SharePoint
  5. Then, Created Apply Each and selected forecastday from JSON Parser output (here I got stuck and I want to update SharePoint list in one line)

 

My SharePoint Custom list structure

  1. Title (for today date store)
  2. CurrentTemp (for Current Tempearture)
  3. CurrentText (for Current Tempearture Text)
  4. Day_1 (next day date from forecast)
  5. Day_1_h (next day high tempreature from forecastday) 
  6. Day_1_L (next day low tempreature from forecastday)
  7. Day_2 (next day date from forecast)
  8. Day_2_h (next day high tempreature from forecastday) 
  9. Day_2_L (next day low tempreature from forecastday)
  10. Day_3 (next day date from forecast)
  11. Day_3_h (next day high tempreature from forecastday) 
  12. Day_3_L (next day low tempreature from forecastday)
  13. Day_4 (next day date from forecast)
  14. Day_4_h (next day high tempreature from forecastday) 
  15. Day_4_L (next day low tempreature from forecastday)
  16. Day_5 (next day date from forecast)
  17. Day_5_h (next day high tempreature from forecastday) 
  18. Day_5_L (next day low tempreature from forecastday)
  19. Day_6 (next day date from forecast)
  20. Day_6_h (next day high tempreature from forecastday) 
  21. Day_6_L (next day low tempreature from forecastday)
  22. Day_7 (next day date from forecast)
  23. Day_7_h (next day high tempreature from forecastday) 
  24. Day_7_L (next day low tempreature from forecastday)

 

I am looking for any suggestion to improve my flow or solve my issue. Please help

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: JSON - Adding Multiple rows in SharePoint Custom List in one row

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:

31.PNG32.PNG

By analogy, to get the data for the next day, just change the index.

Please take a try.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Highlighted
Community Support
Community Support

Re: JSON - Adding Multiple rows in SharePoint Custom List in one row

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,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Frequent Visitor

Re: JSON - Adding Multiple rows in SharePoint Custom List in one row

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"}}]}}
Highlighted
Community Support
Community Support

Re: JSON - Adding Multiple rows in SharePoint Custom List in one row

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:

31.PNG32.PNG

By analogy, to get the data for the next day, just change the index.

Please take a try.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Kudo Collector
Kudo Collector

Re: JSON - Adding Multiple rows in SharePoint Custom List in one row

Hi @v-bacao-msft  - how did you take the values from the variables and create the items for the sharepoint list?

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (7,425)