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 / Extract specific attri...
Power Automate
Unanswered

Extract specific attributes of an array to form a new array

(0) ShareShare
ReportReport
Posted on by 82

Hi,

 

I have the following a big Array that looks like this. 

{
    "body": [
        {
            "Date""24/Apr/2023",
            "Subject""Maths",
            "Start Time""08:30 AM",  
            "End Time""09:30 AM",
            "Lunch Duration"0
        },
        {
            "Date""24/Apr/2023",
            "Subject""Lunch",
            "Start Time""12:00 PM",
            "End Time""12:30 PM",
            "Lunch Duration"30
        },
        {
            "Date""24/Apr/2023",
            "Subject""English",
            "Start Time""02:30 PM",
            "End Time""03:30 PM",
            "Lunch Duration"0
        }
{
            "Date""25/Apr/2023",
            "Subject""Maths",
            "Start Time""07:30 AM",
            "End Time""09:30 AM",
            "Lunch Duration"0
        },
        {
            "Date""25/Apr/2023",
            "Subject""Lunch",
            "Start Time""12:00 PM",
            "End Time""12:50 PM",
            "Lunch Duration"50
        },
        {
            "Date""25/Apr/2023",
            "Subject""English",
            "Start Time""01:30 PM",
            "End Time""03:30 PM",
            "Lunch Duration"0
        }

    ]
}

I want to create a new Array that combines the first 3 attributes such that my new Array looks like this.
 
{
"body": [
        {   "Date": "24/Apr/2023",
           "Start Time": "08:30 AM",
           "Lunch Duration": 30,
          "End Time": "03:30 PM"
       }
      {   "Date": "25/Apr/2023",
           "Start Time": "07:30 AM",
           "Lunch Duration": 50,
          "End Time": "03:30 PM"
       }
]
}
 
I'm only interested in the "Date", "Start Time", "Lunch Duration" and "End Time" in that order. My original Array has that in this order.
 
Thank you 
Categories:
I have the same question (0)
  • ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi @User_Naami 

     

    As per my understanding you are looking for reordering the 'body' array and save it in another array variable. To achieve this, you may use "Select" action for reordering the elements and then use the output of "Select" action to create a new array variable.

     

    Sample flow with actions are as follows:

    ManishSolanki_0-1683123772376.png

    ManishSolanki_1-1683123899396.png

     

    If it solves your problem then, please remember to give a 👍 and accept my solution as it will help others in the future.

     

    Thanks

     

  • User_Naami Profile Picture
    82 on at

    HI @ManishSolanki The logic does not work for me. 

    This is what my flow looks like that produces my array.

    User_Naami_0-1683142982576.png

     

    The result of my "Select" produces the following array:

    {
        "body": [
            {
                "Date""24/Apr/2023",
                "Subject""Maths",
                "Start Time""08:30 AM",  
                "End Time""09:30 AM",
                "Lunch Duration"0
            },
            {
                "Date""24/Apr/2023",
                "Subject""Lunch",
                "Start Time""12:00 PM",
                "End Time""12:30 PM",
                "Lunch Duration"30
            },
            {
                "Date""24/Apr/2023",
                "Subject""English",
                "Start Time""02:30 PM",
                "End Time""03:30 PM",
                "Lunch Duration"0
            }
    {
                "Date""25/Apr/2023",
                "Subject""Maths",
                "Start Time""07:30 AM",
                "End Time""09:30 AM",
                "Lunch Duration"0
            },
            {
                "Date""25/Apr/2023",
                "Subject""Lunch",
                "Start Time""12:00 PM",
                "End Time""12:50 PM",
                "Lunch Duration"50
            },
            {
                "Date""25/Apr/2023",
                "Subject""English",
                "Start Time""01:30 PM",
                "End Time""03:30 PM",
                "Lunch Duration"0
            }

        ]
    }

     

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 463 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 427 Moderator

#3
abm abm Profile Picture

abm abm 245 Most Valuable Professional

Last 30 days Overall leaderboard