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

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Escaping $ in JSON

(0) ShareShare
ReportReport
Posted on by 310

I want to end up with a JSON object that looks like this:

{"$content-type": "inputparameter1","$content": "inputparameter2"}

where the "inputparameter" strings are supplied via a PowerApps trigger (text and text_1). the JSON object is a parameter in a subsequent action.

I'm using a Compose action with this function:

json(concat('{','"$content-type":"',triggerBody()?['text'],'","$content":"',triggerBody()?['text_1'],'"}'))

but it fails. If I take the $ characters out, it succeeds.

I've tried '"\$content-type and '"%"$"%content-type but can't get it to work.

How can I escape a $ character when constructing a JSON object?

I have the same question (0)
  • v-yueyun-msft Profile Picture
    on at
    Re: Escaping $ in JSON

    Hi , @JonathanGibbs 

    I test it in my side , it also give the internal error .

     For your need ,you can try to use the Select action to realize it .

    vyueyunmsft_0-1700788498845.png

    Then we can get the result as follows:

    vyueyunmsft_1-1700788521700.png

     

    Best Regards,

    Yueyun Zhang

     

     

  • Verified answer
    grantjenkins Profile Picture
    11,059 Moderator on at
    Re: Escaping $ in JSON

    I would use a variable of type Object instead of Compose which should work.

     

    grantjenkins_0-1700811625999.png

     

    json(concat('{', '"$content-type":"', triggerBody()['text'], '","$content":"', triggerBody()['text_1'], '"}'))

     

    grantjenkins_1-1700811663497.png

  • JonathanGibbs Profile Picture
    310 on at
    Re: Escaping $ in JSON

    @grantjenkins Thanks. Learned something new there about Compose vs Variable

    @v-yueyun-msft That's a neat solution YueYen - cleaner than the clunky text manipulation, perhaps. Need to isolate item [0] from the array of course

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 691 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 431 Moderator

#3
developerAJ Profile Picture

developerAJ 266

Last 30 days Overall leaderboard