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
Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,327)