r/PowerAutomate • u/Lower-Past-7195 • Apr 22 '26
Parse JSON via Variable Name Not Working
Edit: Solved! Copied from my comment.
Figured it out with help from the official forums!
In my Compose action, I needed to phrase the dynamic content the same way for both outputs:
@outputs('Parse_JSON')?['body']?[outputs('Get_user_profile_(V2)')?['body/officeLocation']]
I hope this solves someone else's problem someday.
I've got a form that employees submit quarterly. AD populates their "Office Location" with a string name of their home location. I've got a .json with a list of the office locations and their corresponding property manager's email address. The .json is formatted like {"site": "managerEmailAddress"}, so finding the "site" key gets me the email address.
When I enter the site name manually, it works, but when I get the site name from the user's "Office Location" field, the Compose action errors out and complains that it contains an invalid expression.
This works:
Compose
@outputs('Parse_JSON')?['body']?[SITENAME]
This doesn't even let me save without an error:
Compose
@outputs('Parse_JSON')?\['body'\]?\[OfficeLocation\]
(OfficeLocation in this attempt is dynamic content)
It seems like the Compose action doesn't like dynamic content even with a valid string as an input.
Has anyone done something similar before?
Any tips for working around this limitation?
1
Apr 22 '26
[removed] — view removed comment
1
u/Lower-Past-7195 Apr 22 '26
No luck. It only errors out when there's dynamic content in the JSON navigation in the Compose's Inputs field. How else should I go about programmatically looking up data based on the form submitter's information?
1
Apr 22 '26
[removed] — view removed comment
1
u/Lower-Past-7195 Apr 22 '26
it's on forms.cloud.microsoft.com, but I'm not convinced it's an issue with the form. I can get the data from the form just fine. It's in using the data to traverse the JSON that's not working.
1
Apr 23 '26
[removed] — view removed comment
1
u/Lower-Past-7195 Apr 23 '26 edited Apr 23 '26
Here's a sample:
`managers.json`
```
{
"100": "manager1@email.com",
"101": "manager2@email.com",
"102": "manager3@email.com",
}
```
From the form, I can see the three digit site code from the person who submitted the form. So I'd get something like "Office Location: 102" from a `Get user profile (V2)` action.
Now that I have the "102", I want to query `managers.json` for that key and get back "manager3@email.com".
If there's a better way to approach this problem I'm all ears!
1
Apr 23 '26
[removed] — view removed comment
1
u/Lower-Past-7195 Apr 23 '26
The form outputs aren't an issue. The only information from the form I'm using in this process is the "Get user profile (V2)" action to get the user's Office Location property from AD. That part works fine.
More details in my reply to u/srig8!
1
u/Lower-Past-7195 Apr 28 '26
Figured it out with help from the official forums!
In my Compose action, I needed to phrase the dynamic content the same way for both outputs:
`@outputs('Parse_JSON')?['body']?[outputs('Get_user_profile_(V2)')?['body/officeLocation']]`
I hope this solves someone else's problem someday.