Filtering a JSON Array in Power Automate

Hi,

Has anybody filtered JSON in Power Automate?

[{"Constituent ID":"270000","First Name":"Andy","Surname":"Test","Email - primary Number":"xxxxxxxx@chss .org.uk","Event ID":"NXTTest25","Event Name":"NXT Event Testing","Event Merge Name Description":"NXT Event Testing","Participant Registration Date":"8/28/2025"}]

What I'm thinking about doing is sending an email to anyone where the Participant Registration date = Yesterday or Last week from an Outlook address as an alternative to a MailChimp.

Shaun

Answers

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary Kudos 5 Facilitator 3 Raiser's Edge NXT Fall 2025 Product Update Briefing Badge

    you can certainly use Filter array action in power automate to do what you want to do, however, you do need to pay attention to the date data. The data you showed in your post looks to be Query API downloaded data, where the date is in "m/d/yyyy" format. This format to power automate is just a normal string, not a date string. You are likely going to need to use the parseDateTime() expression on the Participant Registration Date before you can do the logical comparison to the addDays(utcNow(), -1) or addDays(utcNow(), -7)

  • Shaun Germany
    edited September 3

    Hi Alex, thank you for that, really appreciated.

    The data presently is coming through the Power Automate query connector and into a .txt file if that makes any difference.

    Am I performing that parseDateTim() after "Compose" and the initial "Parse JSON"?

    Shaun

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary Kudos 5 Facilitator 3 Raiser's Edge NXT Fall 2025 Product Update Briefing Badge

    you can do it multi-actions process or, you can do it in 1 action directly in filter array. the multi-action process (for no/low coder) in a nutshell:

    1. Query API get the data in JSON (you are getting "text" back, but it is not a text file)
      1. not going into the multi-action here to execute, to poll if complete, to check success, to download
    2. Parse JSON on the data that came back so you can use dynamic content more easily
    3. use action to get yesterday date, potentially needing to convert from UTC to your timezone
    4. Use Filter Array
      1. in the condition, you will use expression to parseDateTime() of the Registration date equals to yesterday date

    Condense version without so much more action:

    1. Query API get the data in JSON (you are getting "text" back, but it is not a text file
      1. not going into the multi-action here to execute, to poll if complete, to check success, to download
    2. Filter Array
      1. From: json(base64ToString(body('HTTP_Get_Query_Result')?['$content']))
        1. Assuming the HTTP action name to download query result is HTTP Get Query Result
      2. Condition
        1. LEFT
          1. parseDateTime(item()?['Participant Registration Date'], 'en-US', 'M/d/yyyy')
        2. is equal to
        3. RIGHT
          1. addDays(startOfDay(convertFromUtc(utcNow(), 'Eastern Standard Time')), -1)
  • Just wanting to post a thanks to @Alex Wong here.

    Managed to find some time to look at this and now have a working that is emailing anyone (in a test event presently) with a registration date = yesterday and saving that email into the constituents records.

    Thank you again Alex.