英文:
LogicApp Same Name Values from different Nodes into single array of values
问题
我有一个解析JSON的步骤,它输出了这种结构
[
{
"Value": "Sample Value 1"
},
{
"Value": "Sample Value 2"
}
]
我想要将以下结构转换为
[
"Sample Value 1",
"Sample Value 2"
]
提前感谢。
英文:
I have a parse JSON step which outputs this sort of structure
[
{
"Value": "Sample Value 1"
},
{
"Value": "Sample Value 2"
}
]
I would like to transform the following structure
[
"Sample Value 1",
"Sample Value 2"
]
Thanks in advance
答案1
得分: 1
你需要循环遍历原始数组,并将每个value
属性的值添加到一个线性字符串数组中。
这个流程展示了基本步骤...
首先,我创建了一个新的类型为Array
的变量,用来存储你的原始数据。
接下来,我初始化了另一个变量,它将保存输出的结果。在初始化时,它没有任何值。
最后,使用一个For each
操作,我循环遍历原始数组,在其中有一个Append to array variable
步骤,它将value
属性的值添加到Simple Array
变量中。*Value
字段中的表达式是...
item()?['value']
...这将检索每个项目的值并相应地追加它。
这是最终结果...
一点需要注意的是,如果你希望简单数组的顺序与原始数组的值相同,你需要在For each
步骤的设置中打开并发性,将其设置为1
。
英文:
You need to loop over the original array and the value of add each value
property to a linear string based array.
This flows shows you the basic steps ...
Firstly, I created a new variable of type Array
that stored your original data.
Next, I initialised another variable that will hold the results of the output. When initialised, it was with no value.
Finally, using a For each
action, I loop over the original array and within that, there's an Append to array variable
step which adds in the value of the value
property for each item to the Simple Array
variable. The expression in the *Value
field is ...
item()?['value']
... that will retrieve the value for each item and append it accordingly.
This is the end result ...
One thing to note is, if you want the simple array to be in the same order as the original array values, you need to go to the settings on the For each
step and turn concurrency on to equals 1
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论