简体   繁体   中英

Backslashes and other character combinations in logic apps json

I was wondering why logic apps connectors process json and then adds different characters like "\\" "\\r\\n" and more, in json string when it goes through the workflow.

Is it possible to somehow dodge this problem in logic apps? how do i handle a problem like this best practice.

I have managed to create a Azure Function app that i use to remove these kind of characters and combination through a process of .Replace() . bu i feel like this could be done in a much better way.

Any ideas or suggestions would be much appreciated!

Example:

 { "Employee": "{\\"Address\\":\\"507 - 20th Ave. E.\\\\r\\\\nApt. 2A\\",\\"BirthDate\\":\\"1948-12-08T00:00:00Z\\",\\"City\\":\\"Seattle\\",\\"Country\\":\\"USA\\",\\"EmployeeID\\":\\"1\\",\\"Extension\\":\\"5467\\",\\"Firstname\\":\\"Nancy\\",\\"HireDate\\":\\"1992-05-01T00:00:00Z\\",\\"HomePhone\\":\\"(206) 555-9857\\",\\"Lastname\\":\\"Davolio\\",\\"Notes\\":\\"Education includes a BA in psychology from Colorado State University in 1970. She also completed \\\\\\"The Art of the Cold Call.\\\\\\" Nancy is a member of Toastmasters International.\\",\\"PhotoPath\\":\\"http://accweb/emmployees/davolio.bmp\\",\\"PostalCode\\":\\"98122\\",\\"Region\\":\\"WA\\",\\"ReportsTo\\":\\"2\\",\\"Title\\":\\"Sales Representative\\",\\"TitleOfCourtesy\\":\\"Ms.\\"}" } 

It depends on the expected type of the connector input. For example, HTTP Body or Azure DocumentDB expect type of "object". For those there are no escape characters added and JSON is serialized as-is. However some connectors have a field which is a string like Email Body. In that case the designer takes the input from designer and stringifies it (escaping characters) so a valid string is sent.

Which connector are you referencing here?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM