Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Convert object in request to string

Like (0) ShareShare
ReportReport
Posted on 7 Jun 2020 19:06:23 by Microsoft Employee

I have a post api which takes input or request body as such:

{

"TempName":"123",

"TempInput":"{

  "User1":"mark",

  "User2":"trevor"

}"

}

The "user1" and "user2" are dynamic and I first fetch the schema using TempName(I do it using x-ms-dynamic-schema in th swagger and it works fine,IN FLOW it shows me two text boxes with labels "user1" and "user2" dynamically and i can enter mark and trevor in it;for some other TempName it could show different number of text boxes). Now, my request body becomes like:

{

"TempName":"123",

"TempInput":{

"user1":"mark",

"user2":"trevor"

}

}

I totally oversaw the two double quotes for TempInput's value actually required(that means it is taking a string and not object) and there is no option for me to create a string dynamically in my connector. So, is there a quick fix to convert the object to string and send it as TempInput?

  • Verified answer
    ChristianAbata Profile Picture
    8,947 Most Valuable Professional on 07 Jun 2020 at 19:51:40
    Re: Convert object in request to string

    ohh @t-prrath  I understhand, and my advide is change your API, to accept json, because everyting you manage here in PA is using Json languaje so change your API to accept objects is the best way. 😉

  • t-prrath Profile Picture
    Microsoft Employee on 07 Jun 2020 at 19:43:58
    Re: Convert object in request to string

    Hey @ChristianAbata thanks for the reply but let me clarify; I'll put an image here:

    Z.png

    If you observe, this is my action in my custom connector: If i enter GDPR it shows me 5 boxes(dynamically): if i fill those and run the flow, the connector sends the request as 

    {

     "TempName":"GDPR",

     "TempInput":{

       "GDPR_Name":"mark",

       "GDPR_PostalAddress":"utopia",

       "GDPR_EmailAddress":"something@something.com",

    "GDPR_PhoneNumber":"0",

    "GDPR_ActionType":"do something"

      }

    }

    but the POST API actually expects that the TempInput be a string and not a JSON object; now I cant compromise on the UI; because I want my end user to fill his stuff in my connector's text boxes rather than fillin JSON in compose operation. So how do i workaround this? Do i change my api to accept JSON object or can  I use something I am missing IN THE FLOW itself ?

  • ChristianAbata Profile Picture
    8,947 Most Valuable Professional on 07 Jun 2020 at 19:35:02
    Re: Convert object in request to string

    hi @t-prrath  If I  understand well this is what you need, imagine that my output has your json result.

     

    string.PNG

    string(outputs('Compose'))

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,743 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,089 Most Valuable Professional

Leaderboard