How to remove escape character at an JSON string array?

橙三吉。 提交于 2020-12-15 05:16:30

问题


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.


回答1:


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.

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

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

  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.

  5. In the end, we can use a SetVariable activity to check the result.

After I run debug. We can see the correct result:



来源:https://stackoverflow.com/questions/64713152/how-to-remove-escape-character-at-an-json-string-array

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!