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

Comments

Your Answer

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.