Tip #1446: Empty array in Power Automate

To create an empty array in a Power Automate formula, just use json('[]'). That’s it — there’s your entire tip.

But when might you need this? Let’s say you’re working with the same third-party service as I did the other day. The service returns an array of objects, and you need to loop through the returned objects. Now, if no objects are found, a well-designed service would typically return an empty array. But this one? It returns null. Bleugh. You could add an if action, but there’s a neater solution. Use the following formula in the ‘Apply to each’ action:


This approach uses the coalesce function to check the output from the custom service, and if it’s null, it falls back to an empty array, thanks to json('[]'). Empty array means the loop is simply not executed which is exactly what we wanted.

Cover Image by Andrew Martin from Pixabay.