cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LucaPellegrino
Frequent Visitor

Parse JSON - Flow failure with no attachment

Heya all...

 

So was hoping some of the automate gurus can help a brother out here. This is in relation to an error I'm getting using the Parse JSON step on a flow we've created for the business. The error is as per below

 

Unable to process template language expressions in action 'Parse_JSON' inputs at line '1' and column '27249': 'Required property 'content' expects a value but got null. Path ''.'.

 

Now the flow has been created to capture attachments coming in from a Microsoft Form, pushing the attachment to a SharePoint list. Below is a snippet of the JSON step and code

 

json.png

 

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "name": {
                "type": "string"
            },
            "link": {
                "type": "string"
            },
            "id": {
                "type": "string"
            },
            "type": {},
            "size": {
                "type": "integer"
            },
            "referenceId": {
                "type": "string"
            },
            "driveId": {
                "type": "string"
            },
            "status": {
                "type": "integer"
            },
            "uploadSessionUrl": {}
        },
        "required": [
            "name",
            "link",
            "id",
            "type",
            "size",
            "referenceId",
            "driveId",
            "status",
            "uploadSessionUrl"
        ]
    }
}

 

As there is no other way that I know of to pass these attachments over, I've gone with this approach. Unfortunately for the business it's not a mandatory option to always have an attachment so the flow is failing when something is not attached. The flow works perfectly when an attachment is present

 

Can anyone either know of a better way using the same method (we will most likely be moving to PowerApps in the future) or is this a feature limitation? 

 

Thanks for reading, appreciate any guidance 😉

 

1 ACCEPTED SOLUTION

Accepted Solutions
tom_riha
Super User
Super User

Hello @LucaPellegrino ,

why don't you check before the 'Parse JSON' action if the input 'Attachments/S....' is not empty? A simple condition, if it's empty, skip the 'Parse JSON', if it's not empty, parse it.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

2 REPLIES 2
tom_riha
Super User
Super User

Hello @LucaPellegrino ,

why don't you check before the 'Parse JSON' action if the input 'Attachments/S....' is not empty? A simple condition, if it's empty, skip the 'Parse JSON', if it's not empty, parse it.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

LucaPellegrino
Frequent Visitor

Thanks @tom_riha - I played around yesterday with some of these conditions after looking at some similar threads (searched for them and didnt see many before posting this) and was able to get around it using a similar suggestion to what you highlighted. 

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!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,275)