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

JSON as custom object variable indexing

Hi All,

 

We have data in variable %JsonAsCustomObject% as shown below:

Alvin_Hili1_2-1635340287343.png

 

Alvin_Hili1_1-1635340160794.png

 

If we want to get the data from the firs record, we'd use %JsonAsCustomObject['1']% or if we use %JsonAsCustomObject['1']['name']% we get "root"

 

Alvin_Hili1_0-1635340142400.png

 

But we need to use variables in when indexing for data. So form the above example,where %Temp_Index% is set to 0, we'd like to be able to use %JsonAsCustomObject[Temp_Index]%, but when we try this, we get the error message "Variable 'JsonAsCustomObject' does not support indexing."

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
itomti
Advocate I
Advocate I

Your variable needs to be of type string.

 

Convert it from a number to text. That way you will be able to access the property with a text representation of a number.

View solution in original post

2 REPLIES 2
itomti
Advocate I
Advocate I

Your variable needs to be of type string.

 

Convert it from a number to text. That way you will be able to access the property with a text representation of a number.

Thanks, it worked.

 

I converted the %Temp_Index% variable from number to text format, and used it to access specific data in the custom object: %JsonAsCustomObject[Temp_Index]% or %JsonAsCustomObject[Temp_Index]['totalFolders']%

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.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

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.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

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