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

Speakers, submit your sessions now! Call for speakers ends Feb. 10!

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!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,693)