Paramita Das
Paramita Das

Reputation: 23

Replace Backslash when converting to JSON Array in Azure Logic App

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

Upvotes: 0

Views: 1243

Answers (2)

SwethaKandikonda
SwethaKandikonda

Reputation: 8234

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

Upvotes: 0

Skin
Skin

Reputation: 11197

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

Upvotes: 1

Related Questions