Skip to main content
Community site session details

Community site session details

Session Id : bZBk+dxmFd8YG7L/sIFO9+
Power Automate - General Discussion
Answered

Difference between item()['key'] and item()?['key']

Like (1) ShareShare
ReportReport
Posted on 21 Oct 2020 18:39:19 by 827

Kind of a basic question, but I don't have the vocabulary to put together a proper Google search to answer my question.

 

Basically, there seems to be two different ways of referring to a key or item within an array or JSON object.  One way is like this:

item()['key']

The other is the same, but has a question mark:

item()?['key']

(of course "item()" could be replaced with anything that is an object or an array)

 

I've seen both methods used in different tutorials, and in most cases in my personal use, it seems like there are some instances when either method works.  BUT I have run into situations where one method works, but not the other.

 

So what's the difference?  How do I know whether or not to include the question mark?

 

Thanks,

  • Verified answer
    Jcook Profile Picture
    7,779 Most Valuable Professional on 21 Oct 2020 at 23:28:05
    Re: Difference between item()['key'] and item()?['key']

    Hello @Jronash 

     

    The ? Is there for handling instances where the value cannot be found. The ? Returns a null value rather than throwing an error.


    This post has a great example:

    https://powerusers.microsoft.com/t5/General-Power-Automate/Use-of-Question-Mark-in-expressions/td-p/382181

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2

Loading complete