有没有一种方法可以读取嵌套数组并使用 Azure 数据工厂从嵌套数组中仅提取一个值?
Is there a way to read nested array and extract only one value from the nested array using Azure Data Factory?
我需要从我的存储帐户中读取 json 文件,并仅从 json 对象数组中获取 ID,并仅从数组中提取 ID。
我尝试使用查找 activity 来获取 json 对象的数组,并通过提供 @array(activity('Lookup').output.value[0].lists)
[=12= 将该输出用于每个 activity ]
下面的 json 脚本是查找 activity
的输出
"count": 1,
"value": [
{
"obj": 123,
"lists": {
"employees": [
{
"name": "",
"id": "001",
"tt_1": 0,
"tt_2": 4,
"tt3_": 1
},
{
"name": "",
"id": "002",
"tt_1": 10,
"tt_2": 8,
"tt3_": 1
}```
Need some way to loop through the array of objects and extract only the id and save it in a separate file.
I tried to narrow down till employees using set variables array type but unable to loop through array of objects and extract the id
Please help me to find out some solution to extract the id from the array? Please suggest if sqldb or any other way to extract id?
您可以使用数据流Flatten active将json数组展平value.list.employees
得到ID值,然后将id导入csv文件。
我刚创建了一个和你一样的JSON数据,请参考下面的例子。
{
"count": 1,
"value": [{
"obj": 123,
"lists": [{
"employees": [{
"name": "",
"id": "001",
"tt_1": 0,
"tt_2": 4,
"tt3_": 1
},
{
"name": "",
"id": "002",
"tt_1": 10,
"tt_2": 8,
"tt3_": 1
}]
}]
}]
}
源数据和模式:
展平活动设置和输出预览:
然后我们可以将 ID 数据复制到 SQL 数据库或 csv 文件。
HTH.
我需要从我的存储帐户中读取 json 文件,并仅从 json 对象数组中获取 ID,并仅从数组中提取 ID。
我尝试使用查找 activity 来获取 json 对象的数组,并通过提供 @array(activity('Lookup').output.value[0].lists)
[=12= 将该输出用于每个 activity ]
下面的 json 脚本是查找 activity
的输出"count": 1,
"value": [
{
"obj": 123,
"lists": {
"employees": [
{
"name": "",
"id": "001",
"tt_1": 0,
"tt_2": 4,
"tt3_": 1
},
{
"name": "",
"id": "002",
"tt_1": 10,
"tt_2": 8,
"tt3_": 1
}```
Need some way to loop through the array of objects and extract only the id and save it in a separate file.
I tried to narrow down till employees using set variables array type but unable to loop through array of objects and extract the id
Please help me to find out some solution to extract the id from the array? Please suggest if sqldb or any other way to extract id?
您可以使用数据流Flatten active将json数组展平value.list.employees
得到ID值,然后将id导入csv文件。
我刚创建了一个和你一样的JSON数据,请参考下面的例子。
{
"count": 1,
"value": [{
"obj": 123,
"lists": [{
"employees": [{
"name": "",
"id": "001",
"tt_1": 0,
"tt_2": 4,
"tt3_": 1
},
{
"name": "",
"id": "002",
"tt_1": 10,
"tt_2": 8,
"tt3_": 1
}]
}]
}]
}
源数据和模式:
展平活动设置和输出预览:
然后我们可以将 ID 数据复制到 SQL 数据库或 csv 文件。
HTH.