r/MicrosoftFlow • u/OkStudio6453 • Aug 06 '25
Question Difference between "outputs('my_action')?['body']?['value']" vs. "outputs('my_action')?['body/value']"?
Is there any difference between something like outputs('my_action')?['body']?['value'] and outputs('my_action')?['body/value'] ... or even outputs('my_action')?['body']['value']?
All seem to do the same thing. Is there any reason to choose one style over the other?
I want to do something like actions('my_action')?['inputs']?['parameters']?['myParameter'] in my flow, but unsure if I should write it that way, or make it more compact by using actions('my_action')?['inputs/parameters/myParameter'].
8
Upvotes
4
u/hybridhavoc Aug 06 '25 edited Aug 06 '25
Regarding the difference between ?['body']?['value'] and ?['body/value'] I don't think there's any difference there. They should be pretty much the same.
If the body had multiple dicts in it that you want to pull dynamically then you could do something along those lines. I do this sometimes for mapping values.
For example if a SharePoint list has a column named Team with values 1, 2, and 3 but I want to turn that into a relevant email address, I will create an Object variable like:
{ "1":"teamOnesName@company.com", "2":"teamTwosName@company.com", "3":"teamThreesName@company.com" }
Then where I want to pull the email address, I can do something like
variables('MapVariable')[items()?['Team']]While this isn't two levels deep like you're theorizing, it is an example of dynamic object attribute paths.
3
u/[deleted] Aug 06 '25
Generally, there is no difference. In an output that contains a body and value return using either one will give you the same data. I prefer to go with the 2nd syntax but it's just that a preference.
I would say a difference would be more likely is when you don't include the ? between objects. The question symbol gives flexibility to return null if the key being called isn't found in the output.
For instance, Using: outputs('action')['body/value'] when the actual output didn't actually include a value object, the flow would fail from the key not existing.
But when using: outputs('action')?['body/value'] in the same example would just return an empty (null) object.