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
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

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

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (5,493)