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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Object and array forma...
Power Automate
Answered

Object and array formatting; turning an object into an array

(0) ShareShare
ReportReport
Posted on by 435
I am using an API that returns data in a horrible format that I cannot seem to use. I just need to programmatically turn something with this format:

{
  "987654321": {
    "title": "Item One",
    "amount": 60,
    "id": "987654321"
  },
  "876543210": {
    "title": "Item Two",
    "amount": null,
    "id": "876543210"
  }
}

into something with this format:
 
{
  {
    "title": "Item One",
    "amount": 60,
    "id": "987654321"
  },
  {
    "title": "Item Two",
    "amount": null,
    "id": "876543210"
  }
}
 
The result needs to work with things like a Select action or an Apply to Each action. I am open to trying any suggestions that involve native Power Automate functions and features, as well as suggestions involving Office Scripts. I have been trying to achieve this seemingly simple transformation for far too many hours so any help would be greatly appreciated.
Categories:
I have the same question (0)
  • Suggested answer
    11manish Profile Picture
    3,333 on at
     
  • RBoneck Profile Picture
    435 on at
    @11manish I really don't appreciate AI generated answers. You clearly didn't even bother to test this before spamming it as an answer. Power Automate doesn't even have a values() function.
  • Verified answer
    RBoneck Profile Picture
    435 on at
    For anyone else who needs help in this way, I did find a solution on StackOverflow!

    https://stackoverflow.com/questions/79054768/logic-app-power-automate-extract-checklist-items-from-a-task-from-a-planner-p

    I am not using that paid connector that was mentioned, but the xml option that same person posted does work for me. Here is the summary of what they did:
     
    Say the initial data is held in a compose called Compose_Data.
     
    Compose xpath results
        Inputs: xpath(xml(json(concat('{ "results": ', outputs('Compose_Data'), '}'))), '//results/*')
     
    Select results ids
        From: outputs('Compose_xpath_results')
        Map key: id (or whatever you want to call it)
        Map value: replace(replace(xpath(xml(base64ToString(item()['$content'])), 'name(/*)'), '_x003', ''), '_', '')
     
    Apply to each result
        From: body('Select_results_ids')
        
        //now you can grab whatever fields you have
        Compose title
            Inputs: outputs('Compose_Data')?[items('Apply_to_each_result')?['id']]?['title']
            
        Compose id
            Inputs: outputs('Compose_Data')?[items('Apply_to_each_result')?['id']]?['id']
        
        //you can either append this info to an array variable at this point
        //or just do what you would do with the array from inside this apply to each if you don't need to filter or anything 

     

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 377

#2
11manish Profile Picture

11manish 279

#3
David_MA Profile Picture

David_MA 234 Super User 2026 Season 1

Last 30 days Overall leaderboard