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 / Send an HTTP Request -...
Power Automate
Unanswered

Send an HTTP Request - dealing with quotes in text fields?

(0) ShareShare
ReportReport
Posted on by

Hi,

 

I have a flow that is using a "Send to HTTP request to SharePoint", the flow basically grabs the contents of list item and then uses this to populate another list.  The reason for using the "Sent to HTTP request to SharePoint" action is because the lists have different column names.  A couple of the fields that are copied are text and as such they can have punctuation like double/single quotes.  When this happens the Flow fails, I assume the quote in the text is being inturupted by JSON as the end of the string.  Is there anything I can do to handle punctuation better?  Below is the code view of my "Send to HTTP request to SharePoint" action.

 

{
 "inputs": {
 "host": {
 "connection": {
 "name": "@parameters('$connections')['shared_sharepointonline']['connectionId']"
 }
 },
 "method": "post",
 "body": {
 "method": "POST",
 "uri": "/_api/web/lists/getbytitle('Job Card')/items",
 "headers": {
 "accept": "application/json;odata=verbose",
 "content-type": "application/json;odata=verbose",
 "X-RequestDigest": "form digest value",
 "content-length": "length of post body"
 },
 "body": "{ '__metadata':{ 'type': '@{variables('Type')}' },\n\"Title\": \"@{triggerBody()?['Job_x0020_Summary']}\",\n\"Description_x0020_of_x0020_job\": \"@{triggerBody()?['Job_x0020_Description']}\",\n\"Requestor\": \"@{triggerBody()?['Title']}\",\n\"Request_x0020_Date\": \"@{triggerBody()?['Date']}\",\n\"Hours\": \"@{triggerBody()?['Total_x0020_Hours']}\"\n}"
 },
 "path": "/datasets/@{encodeURIComponent(encodeURIComponent(triggerBody()?['Customer_x0020_Name_x003a_Custom']?['Value']))}/httprequest",
 "authentication": "@parameters('$authentication')"
 },
 "metadata": {
 "flowSystemMetadata": {
 "swaggerOperationId": "HttpRequest"
 }
 }
}

Thanks in advance

Rob

Categories:
I have the same question (0)
  • Ed Gonzales Profile Picture
    4,531 Most Valuable Professional on at

    @Rob_CTL 

    Hey there.  It seems like a Replace() might work here.  Take a look at this thread doing the same thing with Twitter data.  Keep us posted.

     

    -Ed-

     

     

    If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

  • v-bacao-msft Profile Picture
    on at

     

    Hi @Rob_CTL ,

     

    Providing screenshots of the Flow configuration and details of the error message may help us analyze this issue.

     

     

    Best Regards,

  • Rob_CTL Profile Picture
    on at

    Hi @v-bacao-msft 

     

    Thanks for the reply, the whole flow is as follows, note that the HTTP request action is getting the value of a field that contains a URL.  This URL is then used in the path to the second list.  

     

    Flow-quotes1.jpg

     

    Flow-quotes2.jpg

     

    Flow-quotes3.jpg

     

    Rob

  • v-bacao-msft Profile Picture
    on at

     

    Hi @Rob_CTL ,

     

    It seems that your configuration is fine. You could try to change the double quotes to single quotes when configuring fields in the Body.

    If you have any error messages, please provide them to us.

    Also, please refer to the Online doc for more details on creating an item using the Rest API:

    https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest#create-list-item

     

    Best Regards,

  • Rob_CTL Profile Picture
    on at

    Hi @v-bacao-msft 

     

    Thanks for the reply, I've tested with using single quotes and the Flow will now ignore double quotes in the text, happy days!  Sadly it now falls over when it hits a single quote.

     

    The error I get is as follows:

     

    Invalid JSON. A comma character ',' was expected in scope 'Object'. Every two elements in an array and properties of an object must be separated by commas.

     

    flow-singlequote.jpg

    Thanks

    Rob

     

  • v-bacao-msft Profile Picture
    on at

     

    Hi @Rob_CTL ,

     

    It seems that the description field value contains single quotes, perhaps you can try not to use double quotes or single quotes.

     

    Best Regards,

  • Rob_CTL Profile Picture
    on at

    @v-bacao-msft that would be a nice simple solution, sadly the fields need to be wrapped in quotes.

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard