cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ChrisCC
Level: Powered On

Handling NULL in Parse JSON

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?

1 ACCEPTED SOLUTION

Accepted Solutions
JoeGasper
Level: Powered On

Re: Handling NULL in Parse JSON

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-JSO...

View solution in original post

2 REPLIES 2
Highlighted
Community Support Team
Community Support Team

Re: Handling NULL in Parse JSON

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

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
JoeGasper
Level: Powered On

Re: Handling NULL in Parse JSON

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-JSO...

View solution in original post

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Users online (5,289)