cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AlexisVossloh
Helper I
Helper I

filter json array

Hello,

 

I have a json table with 2 entries for roles and mail, I would like to retrieve in this table only the mail related to the admin role.

Here is what my json returns

[
  {
    "mail": [
{
"mail": "Mail1@mail.com"
},
{
"mail": "Mail2@mail.com"
}
],
"roles": [
{
"roles": "admin"
},
{
"roles": "user"
}
]
}
]

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @AlexisVossloh 

 

It won't.  You have to type an expression item()?['role'] - in the comments.  

 

Damien

View solution in original post

5 REPLIES 5
DamoBird365
Super User
Super User

Hi again @AlexisVossloh 

 

If you're looking to get the first email each time, you would use something like:

outputs('Array')?[0]?['mail']?[0]?['mail']
 

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 😉

Hi again @DamoBird365 , my project is not easy

 

my content is dynamic so for example I have 10 mails and 10 roles, 5 admin roles, I would like to have an output table with the 5 mails that have an admin role

Hi @AlexisVossloh 

 

DamoBird365_0-1631542835640.png

 

Select is made up of the following:

FROM range(0,length(outputs('Array')?[0]?['mail']))

EMAIL outputs('Array')?[0]?['mail']?[item()]?['mail']

ROLE outputs('Array')?[0]?['roles']?[item()]?['roles']

 

Output of Filter array is...

DamoBird365_1-1631542906042.png

If there are multiple emails, you can use the select action to return an array of emails and join as before in the solution provided Solved: Re: approval problem with dynamic data mail - Power Platform Community (microsoft.com)

 

Note I have used [0] instead of first().  Different way to achieve same thing.  This video https://youtu.be/6nJSUNh579w is worth watching if you want to learn a bit about arrays.

 

Cheers,

 

Damien

 

 

The filter Array fonction not detect my Role key 

 

AlexisVossloh_0-1631544278894.png

 

Hi @AlexisVossloh 

 

It won't.  You have to type an expression item()?['role'] - in the comments.  

 

Damien

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (2,408)