LogicApp – 更改 JSON

huangapple go评论72阅读模式
英文:

LogicApp - Changing JSON

问题

以下是您提供的JSON数据的转换结果:

  1. [
  2. {
  3. "An Id": 123,
  4. "Full Name": "John Doe",
  5. "New Field Added": "A value which is new"
  6. },
  7. {
  8. "An Id": 124,
  9. "Full Name": "James Deen",
  10. "New Field Added": "A new value"
  11. }
  12. ]

希望这有助于您解决问题。如果您需要更多帮助,请随时提问。

英文:

I have some JSON like this produced from a step in the LogicApp I am working on.

  1. [
  2. {
  3. "id": 123,
  4. "displayName": "John Doe",
  5. "firstName": "John",
  6. "lastName": "Doe",
  7. "gender": "Male",
  8. "jobTitle": "Customer Service Representative",
  9. "workPhone": "555-555-5555",
  10. "workPhoneExtension": null,
  11. "skypeUsername": "JohnDoe",
  12. "facebook": "JohnDoeFacebook"
  13. },
  14. {
  15. "id": 124,
  16. "displayName": "James Deen",
  17. "firstName": "James",
  18. "lastName": "Deen",
  19. "gender": "Male",
  20. "jobTitle": "Job Title",
  21. "workPhone": "555-555-5555",
  22. "workPhoneExtension": null,
  23. "skypeUsername": "JamesDean",
  24. "facebook": "JamesDeenFacebook"
  25. }
  26. ]

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?

  1. [
  2. {
  3. "An Id": 123,
  4. "Full Name": "John Doe",
  5. "New Field Added", "A value which is new"
  6. },
  7. {
  8. "An Id": 124,
  9. "Full Name": "James Deen",
  10. "New Field Added", "A new value"
  11. }
  12. ]

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
LogicApp – 更改 JSON

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.

LogicApp – 更改 JSON

huangapple
  • 本文由 发表于 2023年3月31日 19:18:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/75897931.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定