Skip to main content

Notifications

Power Automate - Building Flows
Answered

Parse Json

(0) ShareShare
ReportReport
Posted on by 2
I am working on a data request flow with document attachement. I have a flow condition with a JSON Parse to be able to recognise if a document is uploaded. however I have not been able to get the parse payload to work. whenever I generate it, it always fails , This is my sample payload :
 
 [{\"name\":\"FSS Data_Akua Obeng 2.xlsx\",\"link\":\"https://obeneinc-my.sharepoint.com/personal/akuaobeng_obeneinc_com/_layouts/15/Doc.aspx?sourcedoc=%7B593E9F34-83A0-44BB-A7B8-7439ADF5EA9B%7D&file=FSS%20Data_Akua%20Obeng%202.xlsx&action=default&mobileredirect=true\",\"id\":\"013A62YHZUT47FTIEDXNCKPODUHGW7L2U3\",\"type\":null,\"size\":10963,\"referenceId\":\"013A62YHZZFKXHOZ4WPJAIJNM6NJBGOIAW\",\"driveId\":\"b!jiDeHrvbqkqBh0pVbFw6aSO9vUCYieVLhyQh29nIzsBGaGVcPFAVQpkLD0Qc8BFy\",\"status\":1,\"uploadSessionUrl\":null}]
 
This is not able to generate the schema or it generates the wrong schema and the flow fails. 
 
 
 
Can someone please give some ideas?   Thank you
  • Suggested answer
    CU17012354-0 Profile Picture
    CU17012354-0 2 on at
    Parse Json
    Hello Karim, Thank you so much your code worked like magic, that was awesome , I am grateful. 
  • Verified answer
    Ellis Karim Profile Picture
    Ellis Karim 10,556 on at
    Parse Json
    (1) Add a compose action
     
    (2) Enter the expression as shown below for your file upload question (in your case it's Please Upload....)
     
    (3) Examine the run time output. This is the content you can use for the ParseJSON sample payload.
     
    This is the output I get when using your sample data:
     
     
    [
        {
            "name": "FSS Data_Akua Obeng 2.xlsx",
            "link": "https://obeneinc-my.sharepoint.com/personal/akuaobeng_obeneinc_com/_layouts/15/Doc.aspx?sourcedoc=%7B593E9F34-83A0-44BB-A7B8-7439ADF5EA9B%7D&file=FSS%20Data_Akua%20Obeng%202.xlsx&action=default&mobileredirect=true",
            "id": "013A62YHZUT47FTIEDXNCKPODUHGW7L2U3",
            "type": null,
            "size": 10963,
            "referenceId": "013A62YHZZFKXHOZ4WPJAIJNM6NJBGOIAW",
            "driveId": "b!jiDeHrvbqkqBh0pVbFw6aSO9vUCYieVLhyQh29nIzsBGaGVcPFAVQpkLD0Qc8BFy",
            "status": 1,
            "uploadSessionUrl": null
        }
    ]

    ​​​​​​​Here is a schema I generated, with some minor edits - "type" and "uploadSessionUrl" can either be a "string" or "null" and are not required since the values can be null.
    {
        "type": "array",
        "items": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string"
                },
                "link": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "type": {
                    "type": ["string", "null"]
                },
                "size": {
                    "type": "integer"
                },
                "referenceId": {
                    "type": "string"
                },
                "driveId": {
                    "type": "string"
                },
                "status": {
                    "type": "integer"
                },
                "uploadSessionUrl": {
                    "type": ["string", "null"]
                }
            },
            "required": [
                "name",
                "link",
                "id",
                "size",
                "referenceId",
                "driveId",
                "status"
            ]
        }
    }
    


     
    Ellis Karim

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,580

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,909

Leaderboard