vincentlowe

ObjectConstructorEvaluation

Mar 31st, 2022 (edited)
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. %dw 2.0
  2. output application/json
  3. var o1 = {one:1,two:2}
  4.  
  5. /*
  6. * When you build this up, line by line, you begin to
  7. * see how the combination of these elements work
  8. * the comment on the "allFour" line contains the punchline
  9. */
  10. ---
  11. {
  12. ogData: o1,
  13. objectInsideConstructor: {(o1)},
  14. // onlyConstructor: {o1}, // error - o1 is already an object
  15. objectAdded: {(o1),three:3,four:4},
  16. // badObjectAdded: {(o1),{three:3,four:4}}, // error
  17. allFour: {(o1),({three:31,five:55}),four:4} orderBy $ // parentheses extract kvps
  18. }
Add Comment
Please, Sign In to add comment