[英]How to flatten array of arrays in json using jsonata
I want to flatten an array of arrays in json data into array of objects.我想将 json 数据中的 arrays 数组展平为对象数组。 I am giving input and expected output. I am not familiar with some flattening functions in jsonata and that's where I need help.我正在提供输入和预期 output。我不熟悉 jsonata 中的一些扁平化功能,这就是我需要帮助的地方。
Input:输入:
[
[
{
"date": "2022-09-22",
"name": "modules/dynatrace",
"count": 60
},
{
"date": "2022-09-22",
"name": "modules/dynatrace/monitors/http-monitors/basic",
"count": 4
}
],
[
{
"date": "2022-09-22",
"name": "modules/splunk/hec-token",
"count": 14
},
{
"date": "2022-09-22",
"name": "modules/aws/lambda/logs_streaming_splunk",
"count": 29
}
]
]
Output: Output:
[
{
"date": "2022-09-22",
"name": "modules/dynatrace",
"count": 60
},
{
"date": "2022-09-22",
"name": "modules/dynatrace/monitors/http-monitors/basic",
"count": 4
},
{
"date": "2022-09-22",
"name": "modules/splunk/hec-token",
"count": 14
},
{
"date": "2022-09-22",
"name": "modules/aws/lambda/logs_streaming_splunk",
"count": 29
}
]
I used below command as mention in the another ticket and it worked for me.|https://stackoverflow.com/questions/49570172/jsonata-query-to-flatten-array-of-arrays我在另一张票中使用了以下命令,它对我有用。|https://stackoverflow.com/questions/49570172/jsonata-query-to-flatten-array-of-arrays
$reduce($, $append)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.