MuleSoft MCD-Level-1 Question Answer
What DataWeave expression transforms the array a to the XML output?
1.1. trains:
2.2. {(
3.3. a map ((engId, index) ->
4.4. train: {
5.5. TrainNumber: engId
6.6.
7.7. }
8.8. )
9.9. )}
2.2. a map ((engId, index) ->
3.3. train: {
4.4. TrainNumber: engId
5.5.
6.6. }
7.7. )
1.1. {(
2.2. trains:
9.)}
1.1. {
9.}
For such questions always look for Syntax:
I call it "Wrap the Map"
trains:
{(
When mapping array elements (JSON or JAVA) to XML, wrap the map operations in {(..)}
-{ } are defining the object
-( ) are transforming each element in the array as a key/value pair
TESTED 31 Jul 2025
Copyright © 2014-2025 ACE4Sure. All Rights Reserved