Skip to main content

Notifications

Community site session details

Community site session details

Session Id : zxiDcn1rqohWFkmkBJs/PP
Power Automate - Building Flows
Answered

multi line string in json is being rejected.

Like (0) ShareShare
ReportReport
Posted on 30 Jan 2021 02:23:26 by 10

I'm trying to build my first integration between two platforms. Starting simple. I have the Webhooks receiver working. I've also successfully piped that info into the end platform. 

 

Here's my json that is NOT working:

 

 

 

 

{
	"customer_id": "21742107",
	"subject": "A Subject",
	"problem_type": "Contract Work",
	"user_id": "129173",
	"contact_id": "1153967",
	"location_id": "0",
	"comments_attributes": [
		{
			"subject": "A subject",
			"body": "Alert Details: \nOrganization:"
		}
	]
}

 

 

 

 

Here is the json that works:

 

 

 

 

{
	"customer_id": "21742107",
	"subject": "A Subject",
	"problem_type": "Contract Work",
	"user_id": "129173",
	"contact_id": "1153967",
	"location_id": "0",
	"comments_attributes": [
		{
			"subject": "A subject",
			"body": "Alert Details: Organization:"
		}
	]
}

 

 

 

 

The error I'm getting is:

 

Unable to process template language expressions in action 'HTTP' inputs at line '1' and column '7956': 'Error reading string. Unexpected token: StartArray. Path 'queries.comments_attributes'.'.

 

Obviously, the issue is the newline. I've tried 0, 1, 2, 3 and 4 backslashes. Except, every json validator I can find says both the top and the bottom json are valid. I even tried inserting Compose in front of my http function to format that field prior to calling it. Same error. 

 

So, bottom line, I want to format that one value, but PA won't let me put a newline in there. Well, it lets me put the newline in there and doesn't complain about it, but the process fails every time. 

 

Does anyone have a clue stick to hit this newbie upside the head? I

 

Thanks,

 

Airneil

 

 

  • Verified answer
    abm abm Profile Picture
    32,464 Most Valuable Professional on 03 Feb 2021 at 10:14:38
    Re: multi line string in json is being rejected.

    Hi @Airneil 

     

    These things happens. Glad to hear that all sorted. 

     

    If your problem has solved, please go ahead and mark the post as solved by clicking “Accept as Solution” so that this thread will be marked for other users to easily identify!

     

    Thanks

     

  • Airneil Profile Picture
    10 on 02 Feb 2021 at 04:13:57
    Re: multi line string in json is being rejected.

    I am an idiot...

     

    I figured out that I was using the wrong section. 

     

    I am so sorry for wasting your time. 

     

    -Russ

  • Airneil Profile Picture
    10 on 02 Feb 2021 at 03:26:06
    Re: multi line string in json is being rejected.

    Thanks for sticking with me here. 

     

    I encoded the out put like so.

    Screen Shot 2021-02-01 at 7.03.14 PM.png

    Now when I run the flow, it fails in the same place, with a slightly different error.

    Screen Shot 2021-02-01 at 7.06.37 PM.png

     

    Between this and the last error, I think this card can't handle a json array in the query section. 

  • abm abm Profile Picture
    32,464 Most Valuable Professional on 01 Feb 2021 at 09:35:23
    Re: multi line string in json is being rejected.

    Hi @Airneil 

     

    Try encoding EncodeUriComponent() of compose output.

     

    Thanks

  • Airneil Profile Picture
    10 on 01 Feb 2021 at 04:14:06
    Re: multi line string in json is being rejected.

    Hi again,

     

    I added the compose and created the json there. It still failed...

     

    The error message is:

     

    Unable to process template language expressions in action 'HTTP' inputs at line '1' and column '2262': 'Error reading string. Unexpected token: StartArray. Path 'queries.comments_attributes'.'.

     

    Here's the flow:

    Screen Shot 2021-01-31 at 8.13.18 PM.png

     

     

  • abm abm Profile Picture
    32,464 Most Valuable Professional on 30 Jan 2021 at 22:20:42
    Re: multi line string in json is being rejected.

    Hi @Airneil 

     

    Could you also try the following:

     

    1. Add a compose above the HTTP action step.

    2. Construct the query JSON under the compose.

    3. Next under the HTTP action step > query parameter map the compose output using the EncodeUriComponent() expression.

     

    Thanks

  • abm abm Profile Picture
    32,464 Most Valuable Professional on 30 Jan 2021 at 22:13:41
    Re: multi line string in json is being rejected.

    Hi @Airneil 

     

    Thanks for the screenshot and detailed explanation. Could you try to do the same values using Postman and see if that works or not?

     

    Thanks

  • Paulie78 Profile Picture
    8,407 Super User 2025 Season 1 on 30 Jan 2021 at 21:45:13
    Re: multi line string in json is being rejected.

    For the sake of troubleshooting, I think you should put all of your values:

    organisationName, networkName etc etc into a compose step before the HTTP action. Then, in the HTTP action use the output of the compose in you inserted in the step before. Of course the result should be the same, but I am curious to see if it makes any difference and what the output of that compose turns out to be.

  • Airneil Profile Picture
    10 on 30 Jan 2021 at 21:26:58
    Re: multi line string in json is being rejected.

    Hi abm,

    Thank you for your reply. I will do my best to answer your questions. 

     

    The full error message given is, "Unable to process template language expressions in action 'HTTP' inputs at line '1' and column '7956': 'Error reading string. Unexpected token: StartArray. Path 'queries.comments_attributes'.'."

     

    Maybe of interest is a bit further where their trying to be helpful, it says, "This is a new issue. Try posting about it on our community page—somebody may have a fix."

     

    It looks to me as if the HTTP send can't handle a json array. 

     

    Here is a screenshot of my entire flow.

    Screen Shot 2021-01-30 at 12.49.28 PM.png

     

    Here is the json I entered in the flow. (I removed the API token.) It does not make any difference if I have the dynamic content in there or not. But if I remove the entire 'comments_attributes' array, the flow works. Unfortunately, I need the array for my purpose.

    Screen Shot 2021-01-30 at 1.02.24 PM.png

     

    The following image is the error message I get when I run the flow. As you can see it never gets past parsing the json. 

    Screen Shot 2021-01-30 at 12.57.45 PM.png

  • abm abm Profile Picture
    32,464 Most Valuable Professional on 30 Jan 2021 at 14:55:22
    Re: multi line string in json is being rejected.

    Hi

     

    Under the Parse JSON Action step the above sample data works. So which steps you having the error? Could you please show a screenshot? Also try using the escape characters. See below link.

     

    escaping - How to escape a JSON string containing newline characters using JavaScript? - Stack Overflow

     

    Thanks

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 > Power Automate - Building Flows

#1
stampcoin Profile Picture

stampcoin 43

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 23 Super User 2025 Season 1

#3
Chriddle Profile Picture

Chriddle 21 Super User 2025 Season 1

Overall leaderboard
Loading started