Dealing with escaped characters in Microsoft Forms responses? If you’ve ever tried to loop through multi-select answers in Power Automate and hit the dreaded “result must be a valid array” error, you’re not alone. In this post, I’ll show you the cleanest way to handle escaped JSON — and it’s simpler than you think.
The Problem with Escaped Characters
When you select the dynamic answer from a question and run it through an apply to each action you get an error:
The result of the evaluation of ‘foreach’ expression ‘@outputs(‘Get_response_details’)?[‘body/rcc56958db4dd4ed5add1fdbe90758a2b’]’ is of type ‘String’. The result must be a valid array.
Should you use the replace expression in order to retrieve these values? The answer is NO
Understanding the Forms Response
Below we have a sample multiple answer question on Microsoft Forms. Being so indecisive, 4 choices have been made. The cloud flow output returned by the “Get Response Details” action includes escaped double quotes ". The result looks like follows:
“rcc56958db4dd4ed5add1fdbe90758a2b”: “[\”Green\”,\”Blue\”,\”Orange\”,\”Purple\”]”
The JSON() Expression to the Rescue
How can we work with that? There are many answers suggesting that the replace expression is used. Did you know about the JSON() expression?

Sample Cloud Flow
Below a sample cloud flow that will return three outputs.
Option 1 by using the JSON() expression, the escaped double quotes will be cleaned up. A clean array is returned to use in an apply to each.
Option 2 using the “ReturnLine” compose action with a return line (i.e. insert your cursor and hit return on your keyboard) you can join the array and insert a return between all values. Perfectly formatted for an email or inserting into a field in a SharePoint List or Excel.
Option 3 a new comma seperate list. The alternative to the values returned on seperate lines.

Results from the Flow
For each of the options above, when the cloud flow is run, the following results are returned. Ready to use elsewhere in the flow.
Option 1

Option 2

Option 3

Have you used the json expression before? If you would like to see a use case for Microsoft Forms, convert the form response to a Word Document with dynamic content and then into PDF, click here.