cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Prodigy
Post Prodigy

JSON Formatting

I am working on a flow that is parsing JSON from a PowerApp collection and have an error.    I am pretty sure I know what the problem is, but I don't know how to fix it.

 

There are a couple fields in the collection that may or may not contain any data and I believe this is the issue.

 

json.png

 

 

Here is my JSON schema:

 

{
"type": "array",
"items": {
"type": "object",
"properties": {
"Country": {
"type": "string"
},
"Date": {
"type": "string"
},
"HalfDay": {
"type": "string"
},
"Name": {
"type": "string"
},
"Region": {
"type": "string"
},
"Status": {
"type": "string"
}
},
"required": [
"Country",
"Date",
"HalfDay",
"Name",
"Region",
"Status"
]
}
}
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Hi @JR-BejeweledOne 

You may be able to change the JSON schema to allow both string and null

 

"ResponseNotes": {
                    "type": [
                        "string",
                        "null"
                    ]
                }

More information can be found at the link below

https://www.sharepointsiren.com/2018/10/flow-parse-json-null-error-fix/ 

View solution in original post

3 REPLIES 3
Highlighted
Super User III
Super User III

@JR-BejeweledOne as you've set it in the JSON schema to be required then you need to make sure that in your PowerApp you've also made that field required so there's no possibility that it can be saved and used by the flow with a null value:

requiredTrue.png

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

Highlighted

I didn't write the JSON schema.   I created the first part of the flow where I capture the collection into a variable and then ran it.   I took the result and used the function that creates the JSON from sample data.

 

That field will not be required and is not currently required in the app.   So I need to change the JSON somehow to reflect that so a null value doesn't break it.

 

The problem is, I don't know how to change it.

Highlighted

Hi @JR-BejeweledOne 

You may be able to change the JSON schema to allow both string and null

 

"ResponseNotes": {
                    "type": [
                        "string",
                        "null"
                    ]
                }

More information can be found at the link below

https://www.sharepointsiren.com/2018/10/flow-parse-json-null-error-fix/ 

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (8,704)