cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate I
Advocate I

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
Advocate I
Advocate I

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
Community Support

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
Advocate I
Advocate I

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

Microsoft Ignite 2020

Check out the announcement of Power Platform content at Microsoft Ignite!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Users online (5,880)