How to Handle null data when passing JSON Objects from Flow to PowerApps


A common question in the Power Platform community is how one can Send an JSON object or Array from PowerAutomate to PowerApps, when the value might be null.
I’ve setup a basic example flow to showcase the issue and how this can be solved. In order to return JSON Arrays or Objects from Power Automate we leverage the response action in Power Automate. As you can see in the flow:

PowerApps interprets the data from the response based on the JSON Scema that is specified in the action. The Schema is created through hitting generate from sample, and pasting in a sample JSON output that will be used in the flow. I’ve pasted in the JSON Array from my compose. This gives me the following Schema:

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "Id": {
                "type": "string"
            },
            "Responsible": {}
        },
        "required": [
            "Id",
            "Responsible"
        ]
    }
}

As you can see from the Schema, the Responsible item which had value null does not have a specific datatype and returns: {}. Right now, there’s no standard way for PowerAutomate to handle null values. So when I try to add the Flow to PowerApps it comes up with the following error, which says the Schema cannot be represented in WADL. Code: FlowWadlConversionNotSupported:

So the correct way to build the Schema in order for this to work is to replace the {} with:

{
	"anyof": [
		{
			"type": "string"
		},
		{
			"type": "null"
		}
	]
}

This will let you pass data from Flow to Apps even if your data might be null at times. Be advised that you have change the string to for example “integer”, if that’s the data type which is valid when there’s data in that specific JSON item. Remember to also remove the maybe null values from the required section in your schema. And lastly, you should also refresh your PowerApp before adding the flow again.

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "Id": {
                "type": "string"
            },
            "Responsible": {
                "anyof": [
		{
			"type": "string"
		},
		{
			"type": "null"
		}
	]
}
        },
        "required": [
            "Id"
        ]
    }
}

Success! Your flow should now pass the information from PowerAutomate, even if there is null values.