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

InvalidTemplate: JSON array index (#) is out of bounds

For starters, I am a novice when it comes to JSON and Power Automate but are picking up on it quickly. I have encountered an issue that I am not sure how to troubleshoot.

 

I have an array that's dynamically populated with strings at runtime, the length of the array is also dynamic. The data is sourced from a CSV and converts to the JSON array. The flow is successful for small arrays but upon attempting to scale it up to encompass more data, I started receiving this error:

 

InvalidTemplate. Unable to process template language expressions in action 'Set_Helper_JSON' inputs at line '1' and column '2849': 'The template language expression 'addProperty(variables('Form Data JSON'), variables('CSV Header')[variables('Index')], item())' cannot be evaluated because array index '62' is outside bounds (0, 61) of array. Please see https://aka.ms/logicexpressions for usage details.'.

 

The flow appears to loop through the index successfully until it reaches the final 2 items of the array where it then outputs the above error and fails. Any suggestions for a fix?

 

Below is the code for 'Helper JSON':

 

{
"inputs": {
"name": "Helper JSON",
"value": "@addProperty(variables('Form Data JSON'), variables('CSV Header')[variables('Index')], item())"
}
}
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Visitor

Re: InvalidTemplate: JSON array index (#) is out of bounds

Found the problem.

 

The incoming CSV data include currency which outputs pricing as $1,170.00. During the CSV File to String, it is splitting the value into 2 JSON values; ie. "$1" and "170.00". This occurs twice in the source data resulting in the array being out of bounds.

View solution in original post

1 REPLY 1
Highlighted
Frequent Visitor

Re: InvalidTemplate: JSON array index (#) is out of bounds

Found the problem.

 

The incoming CSV data include currency which outputs pricing as $1,170.00. During the CSV File to String, it is splitting the value into 2 JSON values; ie. "$1" and "170.00". This occurs twice in the source data resulting in the array being out of bounds.

View solution in original post

Helpful resources

Announcements
firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Users online (10,889)