user3440239
user3440239

Reputation: 78

How to append fields in mule dataweave to existing json payload

Exisiting Json { a:1, b:2 }

Add the field c:3

Final Output expected { a:1, b:2, c:3 }

Upvotes: 2

Views: 3066

Answers (2)

Deepak Jain
Deepak Jain

Reputation: 41

You can directly keep payload as it is and add the new JSON field as below:

payload ++ {c:3}

output:
{ 
 a:1,
 b:2, 
 c:3 
}

Upvotes: 1

Manish Yadav
Manish Yadav

Reputation: 290

%dw 2.0
output application/json

---

{ a:1, b:2 } ++ {c: 3}

Sample Output:

{
  "a": 1,
  "b": 2,
  "c": 3
}

Upvotes: 2

Related Questions