Flow Parse JSON Null Error Fix
One of my favorite actions in Flow is the ability to call an HTTP web service, parse the JSON and do whatever you want with the data. The problem is, if you don’t come from a development background then it can be a little intimidating to figure out how to parse the data returned from your HTTP call. In this article, I wanted to address one of the most common errors you see when using the Parse JSON action in Flow.
When testing your Flow with your HTTP and Parse JSON Actions you might get an error that says:
“Invalid type. Expected Number but got Null” or “Invalid type. Expected Integer but got Null”. See screenshot below:
Why This is Happening
You get this error because in the JSON sample schema you are defining what value types each property should be. If a particular property is empty then Flow is seeing that as not matching the schema, because it returned “null” when you told it that it should expect a number so it’s blowing up.
So what’s the fix? In your sample JSON schema, you need to explicitly allow null values for your properties. If you look at the screenshot below, the “nf_saturated_fat” property highlighted in red will error out if it is null because we aren’t allowing null values. The “nf_cholesterol” property highlighted in green, however, will work because it is allowing null values.
Thanks it helped a lot