cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Super User II
Super User II

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

[ ... and if you like my response, you might like also the tips and solutions on my Power Automate related blog ]

View solution in original post

2 REPLIES 2
Super User II
Super User II

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

[ ... and if you like my response, you might like also the tips and solutions on my Power Automate related blog ]

View solution in original post

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
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (24,900)