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 / How To Use a Variable ...
Power Automate
Answered

How To Use a Variable to Parse JSON

(0) ShareShare
ReportReport
Posted on by 12
I have a flow that triggers when a form is submitted.
 
I have a .json file with a list of offices and their corresponding property manager's email address. 
 
It looks like this:
{
  "139 - Site1": ["ManagerName1", "manager1@email.com"],
  "101 - Site2": ["ManagerName2", "manager2@email.com"],
  "116 - site3": ["ManagerName3", "manager3@email.com"],
  "153 - site3": ["ManagerName4", "manager4@email.com"]
  ...
}
I can get the JSON key (e.g., "139 - Site1") from an AD field from an employee who submits the form. I want to use that key to parse the JSON object and get back the array containing ["ManagerName1", "manager1@email.com"] and use it to email the manager.
 
Here are the relevant actions I have set up:
  1. When a new response is submitted
  2. Get user profile (V2)
  3. Get file content using path
  4. Parse JSON
  5. Compose
  6. Send Email Notification
I'm using a compose action with an input of @outputs('Parse_JSON')?['body']?[SITENAME]
 
This flow works flawlessly when I manually input the SITENAME with a string like so: @outputs('Parse_JSON')?['body']?['139 - Site1']
 
However, when I try to use the string from the Get user profile (V2) action, I get an error message complaining that the Compose action contains an invalid expression.
@outputs('Parse_JSON')?['body']?[/OfficeLocation] (the /OfficeLocation is dynamic content from the Get user profile (V2) action).
 
It seems like it's impossible to use dynamic content in a Compose action like this.
 
Has anyone done something similar before?

Any advice for working around this limitation? If there's a better way to do the same thing, I'm all ears.
 
Thanks.
 
I have the same question (0)
  • ninihen Profile Picture
    121 on at
    Try this expression:
    outputs('Get_User_Profile')?['body/officeLocation']
  • NM-27042108-0 Profile Picture
    12 on at
    Thanks for your response.
     
    That code snippet will get me the output named officeLocation from the Get user profile (V2) action. I don't need that string. I'm already able to get that string without error.
     
    The error occurs when I try to use that string to access the JSON data.
     
    I'm looking for a way to use the Office Location as a key in the JSON data to access the values stored within.
  • Suggested answer
    11manish Profile Picture
    1,953 on at
    Try this syntax in your Compose action:

    outputs('Parse_JSON')?['body']?[outputs('Get_user_profile_(V2)')?['body/officeLocation']]
  • NM-27042108-0 Profile Picture
    12 on at
    That worked! Thank you! Now I see the previous answer was saying the same thing. Thank you for being more verbose.
  • Vish WR Profile Picture
    2,253 on at
     
    If it resolved please mark the answer as verified 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 873

#2
Valantis Profile Picture

Valantis 813

#3
Haque Profile Picture

Haque 526

Last 30 days Overall leaderboard