英文:
LogicApp - Changing JSON
问题
以下是您提供的JSON数据的转换结果:
[
{
"An Id": 123,
"Full Name": "John Doe",
"New Field Added": "A value which is new"
},
{
"An Id": 124,
"Full Name": "James Deen",
"New Field Added": "A new value"
}
]
希望这有助于您解决问题。如果您需要更多帮助,请随时提问。
英文:
I have some JSON like this produced from a step in the LogicApp I am working on.
[
{
"id": 123,
"displayName": "John Doe",
"firstName": "John",
"lastName": "Doe",
"gender": "Male",
"jobTitle": "Customer Service Representative",
"workPhone": "555-555-5555",
"workPhoneExtension": null,
"skypeUsername": "JohnDoe",
"facebook": "JohnDoeFacebook"
},
{
"id": 124,
"displayName": "James Deen",
"firstName": "James",
"lastName": "Deen",
"gender": "Male",
"jobTitle": "Job Title",
"workPhone": "555-555-5555",
"workPhoneExtension": null,
"skypeUsername": "JamesDean",
"facebook": "JamesDeenFacebook"
}
]
I was hoping the use of the SELECT component would allow me to exclude fields and essentially rename fields.
How would I transform the above JSON into the following?
[
{
"An Id": 123,
"Full Name": "John Doe",
"New Field Added", "A value which is new"
},
{
"An Id": 124,
"Full Name": "James Deen",
"New Field Added", "A new value"
}
]
At the moment, I am getting issues with FOREACH components being added. I have also used FOREACH loops and various ways to achieve this change.
Would very much appreciate someone explaining the best way to do this.
For example with a SELECT added with one field mapped I see
When adding another it adds a foreach changes things.
Many thanks in advance
答案1
得分: 0
答案是因为我选择了不正确的"from"值。在字段列表中,我包含了JSON中的每个字段,还包括包含值的数组名称,以及一个'body'项目。
当您选择数组名称,比如employees
时,它会出现问题,但如果您使用body
项目,它会正常工作。
英文:
The answer is because I was choosing the incorrect from value. In the list of fields I had each field from the JSON, plus the array name holding the values, plus the a 'body' item.
It goes wrong when you select the array name , in this case employees
but if you use the body
item, it works properly.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论