cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ChrisCC
Advocate II
Advocate II

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

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
v-micsh-msft
Community Support
Community Support

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

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,489)