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 😘

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022- Season 2 has kicked off!

Users online (4,007)