ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 216 - MCD - Level 1 discussion

Report
Export

What is output of Dataweave flatten function?

A.
Object
Answers
A.
Object
B.
Map
Answers
B.
Map
C.
Array
Answers
C.
Array
D.
LInkedHashMap
Answers
D.
LInkedHashMap
Suggested answer: C

Explanation:

Correct answer is Array.

Flatten turns a set of subarrays (such as [ [1,2,3], [4,5,[6]], [], [null] ]) into a single, flattened array (such as [ 1, 2, 3, 4, 5, [6], null ]).

This example defines three arrays of numbers, creates another array containing those three arrays, and then uses the flatten function to convert the array of arrays into a single array with all values.

Source

%dw 2.0

output application/json

var array1 = [1,2,3]

var array2 = [4,5,6]

var array3 = [7,8,9]

var arrayOfArrays = [array1, array2, array3]

---

flatten(arrayOfArrays)

Output

[ 1,2,3,4,5,6,7,8,9 ]

asked 18/09/2024
JULIUS BALNEG
37 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first