web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Convert JSON array to ...
Power Automate
Suggested Answer

Convert JSON array to different array format

(1) ShareShare
ReportReport
Posted on by 2

Hi there,

I have a Json structure like that

[
 {
  "ColumnID": "1",
  "Column1": "Main directory1",
 },

 {
  "ColumnID": "2",
  "Column1": "Main directory2",
 },

 {
  "ColumnID": "3",
  "Column1": "Main directory3",

 },
]

I would like to iterate through it so that at each iteration I read the following values:

 {
  "1": "Main directory1",

  "2": "Main directory2",

  "3": "Main directory3",
 }

 

Categories:
I have the same question (0)
  • Suggested answer
    Ellis Karim Profile Picture
    11,684 Super User 2025 Season 2 on at
    You could try the following method:
     
    The Select action produces the following array:
    [
      {
        "1": "Main directory1"
      },
      {
        "2": "Main directory2"
      },
      {
        "3": "Main directory3"
      },
      {
        "4": "Main directory4"
      },
      {
        "5": "Main directory5"
      },
      {
        "6": "Main directory6"
      },
      {
        "7": "Main directory7"
      },
      {
        "8": "Main directory8"
      },
      {
        "9": "Main directory9"
      },
      {
        "10": "Main directory10"
      },
      {
        "11": "Main directory11"
      },
      {
        "12": "Main directory12"
      }
    ]
     
    Finally I use some string manipulation to change the array into an object:
     
     
    json(replace(slice(string(body('Select')), 1, -1), '},{', ','))
    This is the output:

    Finally I test the newly created object by attempting to reference property 10:
    outputs('Compose')?['10']

    I expect the result to be "Main directory10"

     
     
    Ellis
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard