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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Handling NULL in Parse...
Power Automate
Answered

Handling NULL in Parse JSON

(3) ShareShare
ReportReport
Posted on by 42

I have an API which has the following characteristics:

 

Schema:

 

{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "StartDate": {
        "type": "string"
      },
      "EndDate: {
        "type": "string"
      },

    }

  }
}

**************************

Example failure payload:

{
      "StartDate": "6/15/2017
",
      "EndDate": null,
 }

 

Note that this works if both StartDate and EndDate are not null

 

The Parse JSON step with the above schema returns "Error - Expected String, received null"

 

Replacing the EndDate data type "string" with "any" causes it to be unreadable in following steps (as though it was never parsed) and changing it to "data" causes an internal server error.

 

 

Is there any way to create a schema which allows null values in the "Parse JSON" step?

Categories:
I have the same question (0)
  • v-micsh-msft Profile Picture
    Microsoft Employee on at

    Hi @ChrisCC,

     

    I don't think there would be schema which could allow Null value.

    Please consider replace the Null value with some string, or add a condition to check if the value is Null with the empty funciton.

     

    Or you may consider submit this as an idea, to suggest add the Null support under parse JSON action.

     

    Regards,

    Michael

  • Verified answer
    JoeGasper Profile Picture
    85 on at

    This seems to be working:

     

    "heat_index_f": {
    "type": ["number","null"]
    },
    "heat_index_c": {
    "type": ["number","null"]
    },

     

    https://powerusers.microsoft.com/t5/Building-Flows/parse-JSON-Ignoring-null-value-s-when-parsing-JSON-payload/m-p/31999/highlight/true#M2937

  • TobyJH Profile Picture
    4 on at

    Works for any data type:

    "id_numeric": {
    "type": [
    "integer",
    "null"
    ]
    },
    "department_head_name": {
    "type": [
    "string",
    "null"
    ]
    },
  • SwJ23 Profile Picture
    85 on at

    I used this suggestion for a few flows and it works great, but it prevents me from using Dynamic content from any Parse JSON action whose schema I modify to accept null values. 

     

    After a great deal of dinking around I stumbled across removing the "type": "string" field altogether, leaving in its place a null object. Other than needing to be very careful with where you put the typeless dynamic content, I haven't encountered a serious drawback yet; but that doesn't mean there isn't one!

     

    Your schema:

     

    "heat_index_f": {},
    "heat_index_c": {}

     

    OP Schema:

     

    {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "StartDate": {},
          "EndDate: {},

        }

      }
    }

     

  • testasdfasfsafa Profile Picture
    309 on at

    I can't believe after all these years that Microsoft still hasn't fix this simple issue

  • MichelH Profile Picture
    401 on at

    When I add a second option to the JSON schema, either null or string, power apps simply refuses the refresh of the flow stating: 

    Unable to add flow
    There was a problem adding your service. Please try again later.

    The flow input and output schema cannot be represented in WADL.
    code: FlowWadlConversionNotSupported  

    The  JSON schema seems valid.

    "Maintenance": {
     "type": ["number","string"]
     },
    
    
    "Maintenance": {
     "type": ["number","null"]
     },

     

  • testasdfasfsafa Profile Picture
    309 on at

    There was a roadmap item for power automate to better handle null values, I can't find it anymore 😞

    It's a real pain.  Don't why Microsoft doesn't improve the handling of null values.

  • Verified answer
    Heartholme Profile Picture
    1,278 Super User 2024 Season 1 on at

    @testasdfasfsafa @MichelH 

     

    This should help you: https://powerpostal365.com/2023/10/04/how-to-handle-null-data-when-passing-json-objects-from-flow-to-powerapps/

     

    It works in any case, while the other solution might not always work based on your data/flow. 

     

    ✔ Marking my post as a solution not only confirms that your question has been answered, but also helps others find solutions to similar problems.
    By doing so, you'll be making a valuable contribution to the community.

    Best Regards
    Heartholme

  • Hans Smeets Profile Picture
    39 on at

    This does not seem to work (anymore). The flow accepts the scheme when saving, but it fails when running

  • MarkMillian Profile Picture
    on at

    I got it to work today so it should still be possible. The field that I changed did disapear for me in the beginning but I was able to hardcode the field and make it work. 

     

    {
        "type": "array",
        "items": {
            "type": "object",
            "properties": {
                "Checked": {
                    "type": [
                        "boolean",
                        "null"
                    ]
                },
                "Name": {
                    "type": "string"
                }
            },
            "required": [
                "Checked",
                "Name"
            ]
        }
    }
     
    After the change I was only able to select "name", "Item", or "Body" from my parse json. I just copied the "name" value and wrote "checked" like so:
    items('Apply_to_each')['Name']  --->  items('Apply_to_each')['Checked']

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 598

#2
Valantis Profile Picture

Valantis 477

#3
Vish WR Profile Picture

Vish WR 370

Last 30 days Overall leaderboard