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
 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.

Top Kudoed Authors
Users online (3,717)