cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lucas14
Regular Visitor

Parsing JSON - get the last array

Hi,

I want to get the last array from a tag named profilesData from a JSON file. Im using parse JSON to get the information out of a JSON file from a HTTP response. Then I want to analyse the profilesData array, but as I mentioned only the last one from the two from the HTTP response.

 

lucas14_1-1631621338340.pnglucas14_2-1631621461955.png

This one here:

lucas14_3-1631621488525.png

lucas14_4-1631621662615.png

I tried this, but it says that its an invalid template, because the type is Null.

 

Thanks for your help 🙂

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Paulie78
Super User
Super User

I am not sure if you are trying to get the last element of the body array or just the profilesData within that array. 

Try this code for the final element of the profilesData array:

last(outputs('HTTP')['body'][0]['profilesData'])

or if you want the last element of the body array it would be:

last(outputs('HTTP')['body'])

Blog: tachytelic.net

YouTube: https://www.youtube.com/c/PaulieM/videos

If I answered your question, please accept it as a solution 😘

View solution in original post

1 REPLY 1
Paulie78
Super User
Super User

I am not sure if you are trying to get the last element of the body array or just the profilesData within that array. 

Try this code for the final element of the profilesData array:

last(outputs('HTTP')['body'][0]['profilesData'])

or if you want the last element of the body array it would be:

last(outputs('HTTP')['body'])

Blog: tachytelic.net

YouTube: https://www.youtube.com/c/PaulieM/videos

If I answered your question, please accept it as a solution 😘

View solution in original post

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,543)