%dw 2.0
output application/json
var o1 = {one:1,two:2}
/*
* When you build this up, line by line, you begin to
* see how the combination of these elements work
* the comment on the "allFour" line contains the punchline
*/
---
{
ogData: o1,
objectInsideConstructor: {(o1)},
// onlyConstructor: {o1}, // error - o1 is already an object
objectAdded: {(o1),three:3,four:4},
// badObjectAdded: {(o1),{three:3,four:4}}, // error
allFour: {(o1),({three:31,five:55}),four:4} orderBy $ // parentheses extract kvps
}
Comments