cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Airneil
Frequent Visitor

multi line string in json is being rejected.

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

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
abm
Super User III
Super User III

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

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials

View solution in original post

10 REPLIES 10
abm
Super User III
Super User III

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 Overf...

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials
Airneil
Frequent Visitor

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

Paulie78
Super User III
Super User III

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.

abm
Super User III
Super User III

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



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials
abm
Super User III
Super User III

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



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials
Airneil
Frequent Visitor

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
Super User III
Super User III

Hi @Airneil 

 

Try encoding EncodeUriComponent() of compose output.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials
Airneil
Frequent Visitor

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. 

Airneil
Frequent Visitor

I am an idiot...

 

I figured out that I was using the wrong section. 

 

I am so sorry for wasting your time. 

 

-Russ

abm
Super User III
Super User III

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

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials

View solution in original post

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Users online (21,496)