cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
degvalentine
Level 8

inconsistent quote escaping inside content tokens

Hello Flow Community,

 

I've been struggling with JSON validation, getting the "Enter a valid json" message when the JSON content is valid.

 

I've finally discovered this is due to inconsistent quote escaping inside content tokens. The following is an isolated example.

 

Generally, escaped quotes inside content tokens fail.

2018-10-02 16_55_50-Edit your flow _ Microsoft Flow.png

 

 

Here's the error message after execution.

2018-10-02 17_22_50-Run History _ Microsoft Flow.png

 

The content token needs the quotes unescaped.

2018-10-02 16_56_10-Edit your flow _ Microsoft Flow.png

 

Here's the result of the execution without escaped quotes.

2018-10-02 17_24_57-Run History _ Microsoft Flow.png

 

However, when the content token is embedded into a JSON object, the quote-escaping requirements are reversed.

 

Here's a content token without escaped quotes causing JSON validation errors.

2018-10-02 17_29_51-Edit your flow _ Microsoft Flow.png

 

 

Here's the same JSON object but with a content token having escaped quotes and no errors.

2018-10-02 16_56_33-Edit your flow _ Microsoft Flow.png

 

And the proof that it works with escaped quotes.

2018-10-02 17_31_32-Run History _ Microsoft Flow.png

 

Can anyone explain why this inconsistent behavior of quote escaping inside content tokens is the expected/desired/intended behavior of Flow and not a bug?

 

Thanks.

 

Deg Valentine

 

2 REPLIES 2
Highlighted
degvalentine
Level 8

Re: inconsistent quote escaping inside content tokens

A similar thing happens with quotes inside Select mappings.

 

Here's an isolated example showing a basic mapping.

 

2018-10-03 15_56_53-Edit your flow _ Microsoft Flow.png

 

The output in this base case is as expected:

 

2018-10-03 16_02_32-Run History _ Microsoft Flow.png

 

But if we wrap that item in an array or object, we get unexpected results.

 

2018-10-03 16_03_39-Edit your flow _ Microsoft Flow.png

 

The content token is not replaced with content, but is instead escaped and quoted.

 

2018-10-03 16_04_41-Run History _ Microsoft Flow.png

 

Editing the map in text mode will work.

 

2018-10-03 16_10_44-Edit your flow _ Microsoft Flow.png

 

The output now has the item wrapped in an array:

 

2018-10-03 16_11_21-Run History _ Microsoft Flow.png

 

After reloading the Flow, the correct formatting is preserved and can be edited in text mode safely, so long as the map is kept in text mode.

 

2018-10-03 16_14_04-Edit your flow _ Microsoft Flow.png

 

After making changes to the map, switching to key-value mode causes the content token to get escaped again, even if I switch back to text mode.

tfhegdbn
Level: Powered On

Re: inconsistent quote escaping inside content tokens

Nice sharing. 

I am keen to know as well. 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,728)