Occasionally, while building a Power Automate flow, you’ll need your ParseJSON
action to accept an empty value—whether that value is an object ({}
), array ([]
), or string (""
). By default, ParseJSON balks at these inputs. So how do we get around that limitation?
In this article, I’ll explore a simple, reliable approach that lets your flow handle empty JSON values gracefully.
Create Manually trigger a flow.
Add Initialize variable action.
Name: theEmpty.
Type: String/Array/Object, I choose Array for first try.
{
"type": "InitializeVariable",
"inputs": {
"variables": [
{
"name": "theEmpty",
"type": "array"
}
]
},
"runAfter": { }
}
Then add a Compose.
Input :
json(
if (
or(
empty(variables('theEmpty')),
equal(variables('theEmpty'), '')
)
, '[]'
, 'test' // replace this with the actual json output.
)
)
This make sure if any empty or null input, it will be initialized as []
Last add ParseJSON action.
The content = outputs(‘Compose’)
I use minimal schema for testing. Here any valid schema will work.
Handling empty JSON values in Power Automate boils down to one small adjustment—but it removes a big source of frustration. By letting ParseJSON accept {}
, []
, or ""
, your flows stay resilient and error-free no matter what data comes through. Give the technique a try in your next project, and feel free to share any twists or improvements you discover along the way—there’s always more to automate!