cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
CGILL
Level: Powered On

Parsing json into variables with name and value from separate properties

I'm trying to create a series of actions (preferably as few as possible) that lead to me ending up with easy access to specific values from the json that is received from an API request. The specific json format I have is as follows:

 

{
    "textTabs": [
        {
            "value": "Some UID Value",
            "tabLabel": "UID",
            "tabId": "29066cfd-1731-429e-8f0e-441cd8cd3004"
        },
        {
            "value": "Some Company Name",
            "tabLabel": "ThirdPartyCompany",
            "tabId": "5eaacb3e-36ec-482e-9c56-4f2a0e4ef91d"
        },
        {
            "value": "Some Customer Name",
            "tabLabel": "ProjectCustomer",
            "tabId": "1c56543e-3d5f-4f7a-a14d-72cc6d15aa10"
        },
        ...
        ...
    ],
    "numberTabs": [
        {
            "value": "25",
            "tabLabel": "TaskCurrentReported01",
            "tabId": "53ab067c-fa82-4ace-8ea2-19089c548d82"
        },
        {
            "value": "50",
            "tabLabel": "TaskCurrentReported02",
            "tabId": "4d6b5a09-b673-435d-9081-b0907ca87fce"
        },
        {
            "value": "",
            "tabLabel": "TaskCurrentReported03",
            "tabId": "b6f1481a-e6f0-423d-9d23-2f323e4c6707"
        },
        ...
        ...
    ]
}

What I'd like to end up with are dynamic content placeholders (or some easy way to reference the "values" above by "tabLabel" in order to save the values into a SP list... 

 

So basically I want to end up with dynamic variables as follows "name = value (type)":

UID = Some UID Value (type string)
ThirdPartyCompany = Some Company Name (type string)
ProjectCustomer = Some Customer Name (type string)
TaskCurrentReported01 = 25 (type float)
TaskCurrentReported02 = 50 (type float)
TaskCurrentReported03 = <blank> (type float)

 

Is there any easy way to do the above? I can't seem to think of how to get dynamically named data like this... 

1 REPLY 1
Community Support Team
Community Support Team

Re: Parsing json into variables with name and value from separate properties

Hi @CGILL ,

 

Do you want to make extract value from the JSON then save it into the SharePoint list?

I have made the following test for your reference.

Initialize a variable of text Object with the following JSON data:

 

{"widget": {

    "debug": "on",

    "window": {

        "title": "Sample Konfabulator Widget",

        "name": "main_window",

        "width": 500,

        "height": 500

    },

    "image": {

        "src": "Images/Sun.png",

        "name": "sun1",

        "hOffset": 250,

        "vOffset": 250,

        "alignment": "center"

    },

    "text": {

        "data": "Click Here",

        "size": 36,

        "style": "bold",

        "name": "text1",

        "hOffset": 250,

        "vOffset": 100,

        "alignment": "center",

        "onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;"

    }

}} 

 

Add a Compose action with the following statement to return name of window:

variables('Test')?['widget']['window']['name']

Add a Compose 2 with the following formula to return name of text:

variables('Test')?['widget']?['text']?['name']

Then you could save the output of Compose actions into corresponding fields in SharePoint list.

1.PNG2.PNG

Hope it could be a reference for you.

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors
Users online (6,026)