Categories: Microsoft Flow

Nested arrays with a single item in Power Automate

This post is all about unnecessarily complicated data structures like nested arrays with a single item in them.

Nested arrays Example

How often do you see data like this coming out of an action in Microsoft Flow where an array has a single item with another array:

      "key1": "value 1",
      "key2": "value 2"
      "key1": "value 3",
      "key2": "value 4"

So often I see people getting the following error:

InvalidTemplate. Unable to process template language expressions in action ‘Compose’ inputs at line ‘1’ and column ‘2469’: ‘The template language expression ‘items(‘Apply_to_each’)?[‘key1′]’ cannot be evaluated because property ‘key1′ cannot be selected. Array elements can only be selected using an integer index. Please see for usage details.’.

What does this error mean?

Obviously, you only wanted to get the Key1’s value from the array and you start to think, why doesn’t this just work?

Did you notice in the data that there were two square brackets around the item?

In my case there will only be 1 array of arrays and therefore I can select just the first item. We need to have a look at my overall flow here.

The apply each is taking my nested array and the apply to each still has to handle the inner array.

Therefore rather than using outputs(‘Compose_2’) I could be using outputs(‘Compose_2’)[0] to get to my array of items. Alternatively, you can also use the first() function


Pieter Veenstra

Business Applications and Office Apps & Services Microsoft MVP working as a Microsoft Productivity Principal Consultant at HybrIT Services. You can contact me using

Recent Posts

Call Microsoft Graph from an HTTP Action vs Custom Connector in Power Automate

Is there a difference between calling Microsoft Graph Endpoints using an HTTP action or creating…

5 days ago

Calculate the Sum for a SharePoint column in Power Automate

Last week Shane Young asked me about calculating the Sum for a SharePoint column in…

1 week ago

Object must implement IConvertible in Power Apps

In Power Apps when you do a Patch to create a new item or to…

2 weeks ago

Get started with adaptive cards in Power Automate

Getting started with adaptive cards can be difficult. In this post i have written some…

3 weeks ago

Create PDF documents from data in Power Automate

In this post I will look at how to create PDF documents from data. Use…

3 weeks ago

Unnest nested arrays in Power Automate

We all know this problem, you have a nested array in Power Automate but how…

4 weeks ago