在ADF中将动态JSON内容变平至SQL Server
我正在尝试将动态JSON弄平,并将结果放入SQL Server表中,但我无法做到。 到目前为止,我已经尝试了以下方式。
- 复制活动。来自DB表列的JSON数据未被视为JSON。遗漏。
- 数据流(平坦)。 JSON不包含数组。遗漏。
- 数据流(解析器)。 JSON数据具有灵活的结构,也不适合。
动态调查表列出了下面的JSON结果。
表格A:
{
"q637481270215": { //form unique id
"q16124907150": "Jonny Smith", //name question unique id
"q16124907408": "Yes",
"q16124907765": "08/06/2022", // form unique id for the form created data time
"q16124908929": {
"q16124909751": "7",
"q16124910746": "7",
"q16124910747": "I'd love to find an answer."
}
}
}
Form n:
{
"q637481270216": {
"q161249071512": "Susan Smith",
"q161249074092": "No",
"q161249077662": "18/06/2022",
"q161249089302": {
"q161249097522": "7",
"q161249107472": "7",
"q161249107482": "I'd love to find an answer."
}
,
"q161249089303": {
"q161249097523": "Yes",
"q161249107573": "7",
"q161249107583": "9"
}
}
}
我想将结果弄平/解析这样的SQL Server表:
FormId QuestionPropertyId Answer
---------------------------------------------------------
q637481270215 q16124907150 Jonny Smith
q637481270215 q16124907408 Yes
q637481270215 q16124907765 08/06/2022
q637481270215 q16124908929 {{object}} or disregard
q637481270215 q16124909751 7
q637481270215 q16124910746 7
q637481270215 q16124910747 I'd love to find an answer.
q637481270216 q161249071512 Susan Smith
q637481270216 q161249074092 No
q637481270216 q161249077662 18/06/2022
q637481270216 q161249089302 {{object}} or disregard
q637481270216 q161249097522 7
q637481270216 q161249107472 7
q637481270215 q161249107482 I'd love to find an answer.
......
q637481270216 q161249089303 {{object}} or disregard
q637481270216 q161249097523 No
.........
是否有任何方法可以使用Azure ADF将JSON内容转换为所需的输出格式到SQL Server表?
I am trying to flatten the dynamic JSON and put the result into a SQL Server table, but I have been unable to do so.
I have tried the below ways so far.
- Copy Activity. The json data from a db table column is not recognized as Json. Left out.
- Data flow (Flatten). The json doesn't contain an array. Left out.
- Data Flow (Parser). The json data has a flexible structure and it wouldn't fit either.
The dynamic survey form creates results in JSON shown below.
Form a:
{
"q637481270215": { //form unique id
"q16124907150": "Jonny Smith", //name question unique id
"q16124907408": "Yes",
"q16124907765": "08/06/2022", // form unique id for the form created data time
"q16124908929": {
"q16124909751": "7",
"q16124910746": "7",
"q16124910747": "I'd love to find an answer."
}
}
}
Form n:
{
"q637481270216": {
"q161249071512": "Susan Smith",
"q161249074092": "No",
"q161249077662": "18/06/2022",
"q161249089302": {
"q161249097522": "7",
"q161249107472": "7",
"q161249107482": "I'd love to find an answer."
}
,
"q161249089303": {
"q161249097523": "Yes",
"q161249107573": "7",
"q161249107583": "9"
}
}
}
I'd like to flatten/parse the results into a SQL Server table like this:
FormId QuestionPropertyId Answer
---------------------------------------------------------
q637481270215 q16124907150 Jonny Smith
q637481270215 q16124907408 Yes
q637481270215 q16124907765 08/06/2022
q637481270215 q16124908929 {{object}} or disregard
q637481270215 q16124909751 7
q637481270215 q16124910746 7
q637481270215 q16124910747 I'd love to find an answer.
q637481270216 q161249071512 Susan Smith
q637481270216 q161249074092 No
q637481270216 q161249077662 18/06/2022
q637481270216 q161249089302 {{object}} or disregard
q637481270216 q161249097522 7
q637481270216 q161249107472 7
q637481270215 q161249107482 I'd love to find an answer.
......
q637481270216 q161249089303 {{object}} or disregard
q637481270216 q161249097523 No
.........
Is there any way to transform the Json content to the desired output format to a SQL Server table using Azure ADF?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用Azure数据工厂不支持您的JSON结构。您可以检查此MS
另外,您可以使用 openjson 在您的SQL中解析它的功能。
Your JSON structure is not supported to flatten using the Azure data factory. You can check this MS document for supported JSON patterns in the azure data factory.
Alternatively, you can use the OPENJSON function to parse it in your SQL.