cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate V
Advocate V

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
Advocate V
Advocate V

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.

Highlighted
Helper IV
Helper IV

Re: inconsistent quote escaping inside content tokens

Nice sharing. 

I am keen to know as well. 

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

Users online (7,575)