Business Applications, Common Data Service, Flow, Power Automate, PowerApps, Uncategorized

Power Automate: PARSE JSON action with value or null

Power automate is endless fun!

Today we are going to explore a very “simple” issue which are 2 issues actually:

  1. how to define “allow null” in a schema to avoid annoying errors
  2. how to get away with the 1. without the painful consequences

Let’s start from the beginning!

PARSE JSON is a very useful action and we use it a lot in Power Automate.In my case I parse the response from a third-party API to populate a CDS entity. We can use a Generate from sample to auto-generate a schema.


Which is totally awesome if you’ve got a sample which fully defines your schema. In my schema all values are optional. It doesn’t mean they will always be nulls but it’s bad enough to get a Power Automate error after the first run: “Invalid type. Expected String but got Null” So I understand that the generated schema has to be changed to allow nulls in the response.

We have to modify the schema manually.

There are 3 ways I know and I will list all 3 here below:

  1. Tell that Description can be null:
"LotReference": {
"type": [

2. Tell we have no idea what it is y removing a type mentioning completely:

"LotReference": {}

3. Using anyof in the definition:

 "LotReference": {
                "anyOf": [
                        "type": "string"
                        "type": "null"

I will tell you something: Power Automate hates the first option! Yes, it stops complaining and even parses your response and throughs no errors but it “hides” the Dynamics content values related to the response.

The second option is OK. I will show you the screenshot, however there is another issue with it. It has to be converted via expressions or variables somehow after. If you response is as long as mine this is the last thing you want, really.

There is an option 2 and 1 on the screenshot below.

Options 1 and 2.

With the Dynamic content hidden for ContactReference (option 1) and available for OwnerReference(option 2).

Option 1- “type”:[“string”,”null] doesn’t generate a Dynamic content value.

No-type option 2 definition –

At last, the option 3 is there, in the Dynamic content, with the correct type!

Using anyOf in the schema to define nullable values
All available Dynamic content for PARSE JSON parsed user-friendly

If you want to learn more about PARSE JSON, read John’s blog post here:

He uses a typeless option 2 in his example.

Happy parsing!

11 thoughts on “Power Automate: PARSE JSON action with value or null”

  1. It seems that Power Automate is pretty far behind Integromat and Zapier when it comes to automating flows, unless one is trying to use Dynamics 365, in which case you don’t have a choice but to use Power Automate. This business with having to rewrite your JSON just to get nulls to work is ridiculous. Maybe I’m missing something?


    1. I’d say you are right. It’s good to have a choice. We choose tools which solve our problems better. Within Office 365 space my choice would be to use tools from the same eco system. You’ve got some coding choices as well. It depends on what you are building.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s