如何在 Azure 逻辑应用程序中将字符串转换为数组

How to convert string to array in azure logic app

我有一个逻辑应用程序,只需很少的设计步骤即可执行业务流程。我从 HttpRequest 操作中收到以下响应。

 [{
        "name": "Pradeep",
        "age": 12
    },
    {
        "name": "xyz",
        "age": 15
    }
 ]

之后,我添加了 foreach 操作来迭代上述响应,但出现以下错误:

ExpressionEvaluationFailed. The execution of template action 'Iterate_the_success_response_of_the_Main_Function_App' failed: the result of the evaluation of 'foreach' expression '@outputs('Compose_2')' is of type 'String'. The result must be a valid array.

那么,谁能建议如何将上述 HttpRequest 操作的响应转换为数组

似乎表达式 outputs('Compose_2') 是字符串而不是数组,因此“For each”操作无法循环它并显示错误消息。

您只需要使用表达式 array(outputs('Compose_2')) 即可。