Replace Backslash when converting to JSON Array in Azure Logic App

517 views Asked by At

I am trying to fetch a JSON Array, however the Logic App Response it itself is appending a backslash to the response. Output expected :- { "ABC": [ "000D", "100D", "1200D" ] } I am getting response like below picture

I am trying to use Replace function but it is not allowing to have replace function for array output. Any help is appreciated.

Thanks

2

There are 2 answers

0
Skin On BEST ANSWER

You can do it like this ...

Test Flow

Test Flow

The expression in that second step is ...

json(replace(string(variables('JSON')), '\"', ''))

... which in simple terms is doing the following ...

  1. Converting the object to a string.
  2. Replacing all of the escaped quotes with an empty string.
  3. Converting the string back to a JSON object.

Result

Result

0
SwethaKandikonda On

After reproducing from my end, I could able to get this done by converting the array to string and then use replace function. Below is the flow of my logic app.

enter image description here

enter image description here

Results:

enter image description here