Dinesh Madhup
Dinesh Madhup

Reputation: 367

How to remove escape character at an JSON string array?

In Azure Data Factory, I have Lookup activity. "Lookup" activity, which reads the JSON Data from SQL DB (more than 1 row) and bring into ADF Pipeline.

The lookup activity output contains escape character. Please see this:

 {\ "resourceType\ ":\ "counter","id" :\ "9i5W6tp-JTd-24252\ "

How to remove escape character? Any help is appreciated.

Upvotes: 2

Views: 2677

Answers (1)

Joseph  Xu
Joseph Xu

Reputation: 6063

Since your query result is an JSON String array, we need to do more to remove escape character.

Here is my steps:

  1. Firstly, we can define two array type variables. enter image description here

  2. Here is the summary, the Lookup activity will return an JSON String array. enter image description here Here is the output of my Lookup activity.The data structure will affect the following expression at the Append variable inside the Foreach activity. enter image description here

  3. At the ForEach activity we can use @activity('Lookup1').output.value to get the JSON String array. enter image description here

  4. Inside the ForEach activity, we can use @json(item().value) to get the one object of the JSON String array and remove escape character. enter image description here

  5. In the end, we can use a SetVariable activity to check the result. enter image description here

After I run debug. We can see the correct result:
enter image description here

Upvotes: 3

Related Questions