Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 5uKM2J79cL0DTEGxomPK5x
Power Automate - Building Flows
Answered

Help Parseing dynamic json object array to get key/value pairs

Like (0) ShareShare
ReportReport
Posted on 22 Jun 2021 02:24:51 by

 

Hello i am at a loss here. I have a webhook that posts the body below shown below. I am trying to get the Id/values of the "Questions" object array. The issue is its a dynamic array.  Normally i would just do a string variable and do an expression of something like a parse of questions and then on the variable i would do output('Parse')?[0]?['Value'].  But not all the questions in the questions object array are sent every time.  Plus the order is dynamic.  Any idea how i can select a questions object by Id name vs by the numbered order?  Thanks for your time.  

 

 

{
 "User": {
 "UserEmail": "admin@companyadmin.com",
 "UserFirstName": "Company",
 "UserLastName": "Admin",
 "UserMobile": null,
 "UserPhone": null,
 "UserPsaId": 0,
 "UserOfficeId": "",
 "UserIsAdmin": true,
 "UserIsPriority": false
 },
 "Company": {
 "CompanyName": "test company",
 "CompanyId": 55555555,
 "CompanyTenantId": "123456-7895-1258778785-a074-1a2d2e5e79w7"
 },
 "Ticket": {
 "TicketId": 0,
 "TicketSubject": "test - test - Test",
 "TicketDescription": "test test",
 "TicketEstimatedTime": 0,
 "CheckList": "\n",
 "Script": "\r\n",
 "Questions": [
 {
 "Id": "firstName",
 "Label": "New Employees First Name",
 "Value": "test"
 },
 {
 "Id": "lastName",
 "Label": "New Employees Last Name",
 "Value": "test"
 },
 {
 "Id": "startDate",
 "Label": "Start Date",
 "Value": "2021-6-16"
 },
 {
 "Id": "employeeSupervisor",
 "Label": "Employee Supervisor",
 "Value": "teste"
 },
 {
 "Id": "location",
 "Label": "Location",
 "Value": "USA"
 },
 {
 "Id": "employeeRole",
 "Label": "Employee Role",
 "Value": "Paralegal"
 },
 {
 "Id": "jobTitle",
 "Label": "Job Title",
 "Value": "test"
 }
 ]
 },
 "Feedback": {
 "FeedbackRating": 0,
 "FeedbackSentiment": 0,
 "FeedbackComment": "",
 "FeedbackPhone": ""
 },
 "Routing": {
 "RoutingBoard": "",
 "RoutingStatus": "",
 "RoutingType": "",
 "RoutingSubType": "",
 "RoutingItem": "",
 "RoutingPriority": "",
 "RoutingSource": "",
 "RoutingIsNeedsApproval": false
 },
 "Agent": {
 "AgentId": 0,
 "AgentFirstName": "",
 "AgentLastName": "",
 "AgentEmail": ""
 }
}

 

  • Verified answer
    DamoBird365 Profile Picture
    8,942 Microsoft Employee on 22 Jun 2021 at 05:56:49
    Re: Help Parseing dynamic json object array to get key/value pairs

    Hi @Anonymous 

     

    You could use a select action and repurpose the id as a key with a label and value postfix.  This will return a nested array but as the key value pairs should be unique at this point you can unnest them.

     

    DamoBird365_0-1624341036165.png

    The result would look like follows:

    DamoBird365_1-1624341096163.png

     

    You can then unnest with a series of expressions:

     

    json(replace(join(body('Select'),','),'},{',','))

     

    DamoBird365_3-1624341375435.png

     

    The output of which allows you to call the new object key names - for example firstname_label.

     

    DamoBird365_2-1624341329323.png

     

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    Cheers,
    Damien


    P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉

     

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Building Flows

#1
stampcoin Profile Picture

stampcoin 59

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 47 Super User 2025 Season 1

#3
rzaneti Profile Picture

rzaneti 29 Super User 2025 Season 1

Overall leaderboard
Loading started