我在 Denodo 中导入了一个 JSON 数据源,其中包含 2 个数组。为了处理数据,我将这些数组展平。但是,在传递数据时,我想回到初始数组结构以获得类似的东西
{
"name": "name_of_my_view",
"elements": [
{
"result": [
{
"id": 40033495,
"first_name": Max,
"last_name": Mustermann
},
{
"id": 39960791,
"first_name": "Markus",
"last_name": "Markwart"
}
],
"took_ms": 4,
"result_count": 323,
"errors": [
{}
]
}
],
"links": [
{
"rel": "self",
"href": "https://address"
}
]
}
我已经展平了两个数组(结果,错误),以便在其中编辑各自的域。但是我只看到使用 UNION 来组合它们的选项。如果我这样做,我最终会将所有 fealds 放在一个层次结构中,例如(忽略此示例中的排序)哦,请注意“代码”和“描述”在“错误”数组中,并且没有在上面的示例中显示,因为那里没有错误:
{
"name": "name_of_my_view",
"elements": [
{
"took_ms": 4,
"result_count": 323,
"code": null,
"description": null,
"id": null,
"first_name": null,
"last_name": null
},
{
"took_ms": 4,
"result_count": 323,
"code": null,
"description": null,
"id": 40033495,
"first_name": null,
"last_name": null
}
],
"links": [
{
"rel": "self",
"href": "https://address"
}
]
}