web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Check Empty fields in ...
Power Automate
Answered

Check Empty fields in JSON

(0) ShareShare
ReportReport
Posted on by 62

Hi,

I would like to trigger an email if any of fields are empty (either in column 1 or 2). Example below: triggers an email since column2 has empty values.

 

I was able to convert csv to JSON, below is JSON format.

[
  {
    "Column1": "A",
    "Column2": "bv"
  },
  {
    "Column1": "B",
    "Column2": ""
  },
  {
    "Column1": "C",
    "Column2": "12"
  },
  {
    "Column1": "D",
    "Column2": "45"
  },
  {
    "Column1": "F",
    "Column2": "56"
  }
]
 
 
Thank you
Categories:
I have the same question (0)
  • rzaneti Profile Picture
    4,249 Super User 2025 Season 2 on at

    Hi @spartanboy ,

     

    If I understood correctly, you will need to loop each of the array elements and test if column1 or column2 are empty. If any of these columns from any of the elements are empty, then you will send the email. As you extracted the JSON from a CSV, I'm assuming that all JSON elements will contains the same object keys (which will match to the CSV columns). 

     

    To achieve your goal, first create a boolean variable, initializing it with 'false' value (highlighted in yellow): 

    rzaneti_0-1696453607038.png

     

    You may also notice that I created a variable to store your JSON: this is just for testing purposes and you don't need to replicate it in your flow 🙂

     

    Then insert an 'Apply to each' loop, passing your JSON as input. Inside the loop, add a condition and set an expression to identify if the 'column1' is empty (highlighted in yellow) in the left side of the statement. At the right side of the statement, set 'true' (highlighted in green):

    rzaneti_1-1696453755874.png

    Expression: empty(item()['Column1'])

     

    Inside the 'If yes' block, add a 'Set variable' action to assign the value 'true' to your boolean variable (highlighted in green). You can keep the 'If no' block empty. 

    rzaneti_2-1696453885025.png

     

    Still inside the 'Apply to each' loop, create another condition with the same structure, but now for 'column2':

    rzaneti_3-1696453923666.png

     

    Out of the loop, you can add a new condition to test if your boolean variable is true. If yes, it will send the email. 

     

    Testing the flow:

    The flow ran successfully and the boolean variable returned true (highlighted in yellow), as we have an empty field. 

    rzaneti_4-1696453996704.png

     

    Let me know if it works for you or if you need any additional help!

     

    -------------------------------------------------------------------------
    If this is the answer for your question, please mark the post as Solved.
    If this answer helps you in any way, please give it a like.

    http://digitalmill.net/ 

     

     

  • spartanboy Profile Picture
    62 on at

    Thanks for the immediate response, please help with below error

     

    spartanboy_0-1696455083422.png

     

    The compose the JSON, below is the flow with condition as you mentioned "empty(item()['Column1'])",

    spartanboy_1-1696455202484.png

     

    Since I am new with power automate, the ask is to identify empty values in .csv file (below example) and send out email if there are any empty values. Can you please help with this request?

     

    Column1,Column2
    A,aa
    A,bv
    B,
    C,12
    D,45
    F,56

  • rzaneti Profile Picture
    4,249 Super User 2025 Season 2 on at

    Hi @spartanboy ,

     

    Are you using the item() expression out of the loop? If yes, that's the reason for the error. To access each JSON element with the item() expression, you must pass your JSON as input to an 'Apply to each' loop. If you already did it, please share an image of your 'Appy to each', so we can see how did you populated the input. 

     

    If you need to transfer something from inside a loop to the outside, the easiest way is by creating a variable before the loop (like the boolean one from the previous message), and assign the desired value to it inside the loop with the 'Set variable' action. 

  • spartanboy Profile Picture
    62 on at

    Results in False though Column2 has empty value. Below flow

    1. Output to show complete JSON file

    2. Variable as you mentioned

    3. condition for Column 1 & Column 2

    spartanboy_0-1696478554441.png

     

    FYI. Output for "CompleteJSON" is below

     

     

    [
     {
     "Column1": "A",
     "Column2": "aa"
     },
     {
     "Column1": "A",
     "Column2": "bv"
     },
     {
     "Column1": "B",
     "Column2": ""
     },
     {
     "Column1": "C",
     "Column2": "12"
     },
     {
     "Column1": "D",
     "Column2": "45"
     },
     {
     "Column1": "F",
     "Column2": "56"
     }
    ]

     

    R

  • rzaneti Profile Picture
    4,249 Super User 2025 Season 2 on at

    Hi @spartanboy ,

     

    I've just represented the same flow design as you have and the thighs are running properly in my end:

    rzaneti_0-1696505445441.png

     

    rzaneti_1-1696505468409.png

     

    Your 'CompleteJSON' also looks fine, so it ideally should be working.

     

    In this case, ask you to double check if the dynamic contents/expressions are properly referenced, especially inside the condition (does the empty expressions refer to column1 and column2?) and the 'Apply to each input' (is it referring to the 'CompleteJSON' outputs or to any previous 'Compose' action?

     

    Also, if you still don't have it, please add an additional 'Compose' or variable after the loop, just to store and display the output from 'has_empty_field'.

  • spartanboy Profile Picture
    62 on at

    Yes, adding a variable after the loop helped. Thank you.

     

    But, the .csv files always have a default empty rows at the bottom of dataset, need to exclude these empty rows from the condition

     

    Updated JSON below,

    [
     {
     "Column1": "A",
     "Column2": "aa"
     },
     {
     "Column1": "A",
     "Column2": "bv"
     },
     {
     "Column1": "B",
     "Column2": "a"
     },
     {
     "Column1": "C",
     "Column2": "12"
     },
     {
     "Column1": "D",
     "Column2": "45"
     },
     {
     "Column1": "F",
     "Column2": "56"
     },
     {
     "Column1": "",
     "Column2": ""
     }
    ]

     

  • rzaneti Profile Picture
    4,249 Super User 2025 Season 2 on at

    Hi @spartanboy ,

     

    We have 2 alternatives to handle this totally empty last row. 

     

    1st approach

    If your business rule does not allow any record to have both columns empty at the same time (except, of course, for the last one), you can take this approach:

    rzaneti_0-1696542029968.png

     

    Here you are just adding a new condition to test if column 1 is empty and if column 2 is also empty, and allocating your existent condition statement in the 'If no' block (marked in red). For this outer condition, make sure to set the 'AND' operator (highlighted in yellow) and set the comparison statement as 'is equals to' (highlighted in green).

     

    Let me clarify: in the outer condition, you are asking Power Automate if the current record have both column 1 and column 2 empties. If yes, it will navigate to the 'If yes' block, performing no actions. If not, it will navigate to the 'If no' block, executing your existent condition (is column 1 or column 2 empty?). As you already filtered out the cases where the both columns are empty, the last row won't impact your results.

     

    Here is the output after test this design:

    rzaneti_1-1696542266947.png

     

    2nd approach

    If there is a chance to your flow have a record with both empties col1 and col2 additionally to the last row, you may initialize a 'counter' integer variable to track which record the loop is reading. Set the initial value as 1

    rzaneti_2-1696542623130.png

     

    Inside your outer condition, you will need to include another statement, checking if your json length (highlighted in green; use the expression length([json_dynamic_content])) is equal to the counter (highlighted in yellow):

    rzaneti_3-1696542676771.png

     

    Finally, out of your conditions, but still inside the 'Apply to each' loop, add an 'Increment variable' action, to increase your counter in 1 for each loop iteration:

    rzaneti_4-1696542746160.png

     

     

    To test this design, I made the cols from the 2nd json element empty:

    rzaneti_5-1696542785539.png

     

    When the loop ran into the 2nd json element (highlighted in yellow), the outer condition returned false (highlighted in green, as expected, as the counter is not equal to json lenght):

    rzaneti_6-1696542849726.png

     

    And when running the 7th element (highlighted in yellow), which is the last, the condition returned true (highlighted in green), as the counter matched to json length.

    rzaneti_7-1696542888719.png

     

     

    As the 2nd json element was has empty values, the output is true:

    rzaneti_8-1696542962809.png

     

    Let me know if it works for you or if you need any additional help!

     

    -------------------------------------------------------------------------
    If this is the answer for your question, please mark the post as Solved.
    If this answer helps you in any way, please give it a like.

    http://digitalmill.net/ 

     

  • spartanboy Profile Picture
    62 on at

    @rzaneti

     

    found a simple way for adding 2 conditions, its a success in Flow 2, but the .csv file in Flow 1 is in a different format and has \r, and using same logic as Flow 1 results in an empty array. Can you please help with modifying Flow 1 to result in array as in Flow 1?

    spartanboy_0-1696563184321.png

     

     

    Flow 1 & 2 details are below,

    spartanboy_1-1696563283320.png

     

  • Verified answer
    rzaneti Profile Picture
    4,249 Super User 2025 Season 2 on at

    Hi @spartanboy ,

     

    As your data is organized as an array, I believe that the easier way is just to include another condition to filter out the '\r' in 'Filter array 2'. Also, sometimes the line break is represented as '\n', so you can use the same logic to replace it 🙂

     

    The condition may look like this (using the basic-mode view):

    rzaneti_0-1696591949719.png

     

    Let me know if it works for you!

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard