I want to flatten an array of arrays in json data into array of objects. I am giving input and expected output. I am not familiar with some flattening functions in jsonata and that's where I need help.
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:
[
{
"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
}
]
asked Sep 28, 2022 at 14:07
Ashish Sharma
6801 gold badge11 silver badges26 bronze badges
-
I believe this SO question provides some options: stackoverflow.com/questions/49570172/…mralex– mralex2022年09月28日 14:33:36 +00:00Commented Sep 28, 2022 at 14:33
1 Answer 1
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
$reduce(,ドル $append)
answered Sep 28, 2022 at 14:42
Ashish Sharma
6801 gold badge11 silver badges26 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
default