nerdexam
MuleSoft

MCD-LEVEL-1 · Question #202

What is output of Dataweave flatten function?

The correct answer is C. Array. 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…

DataWeave

Question

What is output of Dataweave flatten function?

Options

  • AObject
  • BMap
  • CArray
  • DLInkedHashMap

How the community answered

(41 responses)
  • A
    2% (1)
  • B
    5% (2)
  • C
    90% (37)
  • D
    2% (1)

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. 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) [ 1,2,3,4,5,6,7,8,9 ]

Topics

#DataWeave#flatten function#array#data transformation

Community Discussion

No community discussion yet for this question.

Full MCD-LEVEL-1 Practice