0

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
1

1 Answer 1

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.