web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Convert WebServiceResp...
Power Automate
Unanswered

Convert WebServiceResponse or json string into list or data row

(1) ShareShare
ReportReport
Posted on by 39

Is there any way to convert WebServiceResponse or json string into list or data row.

I want to insert it to SQL table later, so want to create a insert query using the data received as a WebServiceResponse

 

eg.  data is as below

{

"SITEID": "15",

"SITENAME": "ABC"

}

I have the same question (0)
  • mmonline Profile Picture
    169 on at

    Just convert it to a custom object. You can reference the key/value directly or put them into variables and use the variables in the SQL.

     

    mmonline_0-1687948576798.png

    The SQL below assumes both fields are text/string. If the SiteIDField is numeric just remove the single quotes around the value.

    Insert into TABLENAME (SiteIDField, SiteNameField) VALUES ('%SiteId%','%SiteName%')

     

    If you are receiving several site key/value pairs, use a For Each loop to iterate through and build your SQL in the loop.

  • sakshinatekar Profile Picture
    39 on at

    sorry for the confusion. 

    My data is like below

    {
          "db_status": "Success",
          "data": [
                     {
                     "SITEID": "11",
                     "SITENAME": "ABC",
                     }
                     ]
    }

     

    so it gives error to jsonAsObject.SITEID

    Also tried jsonAsObject['data'].SITEID

     

    one more problem found is after making it as a custom object it is converting data as below

    { 'SITEID': 4, 'SITENAME': ABC}

    It is replacing double quotes to single quotes to keys and no quotes to values. This again creates a new problem

  • mmonline Profile Picture
    169 on at

    Before I provide a solution, are the potentially multiple sites returned - where the array of sites several site key/value pairs?

     

    As in:

    {
     "db_status": "Success",
     "data": [
     {
     "SITEID": "11",
     "SITENAME": "ABC",
     },
     {
     "SITEID": "15",
     "SITENAME": "XYZ",
     },
     {
     "SITEID": "18",
     "SITENAME": "QRS",
     }
     ]
    }

     

  • Verified answer
    mmonline Profile Picture
    169 on at

    If your data only has a single site, per JSON returned, you would use:

    theJSONObject.data[0].SITEIDtheJSONObject.data[0].SITENAME to reference the keys and return the values.

     

    When you have an array [], the arrays create an ordinal value, starting at 0. So, if there is a single key/value pair, you can always get to it using the [0] indicator.

     

    However, if you have multiple sites returned, per my example above, your flow will look like this.

    mmonline_0-1687958815915.png

     

    You will loop through theJSONObject.data.

     

    Each iteration will return an individual site/sitename pair. I set my For Each variable as currentSite rather than CurrentItem for the sake of variable clarity.

     

    Then, in each iteration I can refer to:

    currentSite.SITEIDcurrentSite.SITENAME.

     

    Hope that helps.

  • sakshinatekar Profile Picture
    39 on at

    This worked for me. Thanks a lot

  • Suggested answer
    CU03121756-0 Profile Picture
    2 on at
    If you dont Want use Loop then use this Approach

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard