如何在JSON字符串数组中删除转义符? [英] How to remove escape character at an JSON string array?

查看:149
本文介绍了如何在JSON字符串数组中删除转义符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Azure数据工厂中,我具有查找"活动.查找"活动,该活动从SQL DB(多于1行)读取JSON数据并将其导入ADF管道.

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.

推荐答案

由于您的查询结果是JSON字符串数组,因此我们需要做更多的工作以删除转义符.

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

这是我的步骤:

  1. 首先,我们可以定义两个数组类型变量.

  1. Firstly, we can define two array type variables.

以下是摘要,Lookup活动将返回JSON String数组.这是我的Lookup活动的输出.数据结构将影响Foreach活动中Append变量的以下表达式.

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.

在ForEach活动中,我们可以使用 @activity('Lookup1').output.value 获得JSON字符串数组.

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

在ForEach活动中,我们可以使用 @json(item().value)获取JSON String数组的一个对象并删除转义字符.

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

最后,我们可以使用SetVariable活动来检查结果.

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

运行调试后.我们可以看到正确的结果:

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

这篇关于如何在JSON字符串数组中删除转义符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆