Posts

Showing posts with the label Dataweave

Dataweave 2.0 update function

Image
  Update the user data below. Usernames should be all lower case and the street should be   "Fiskargatan" (example from dataweave tutorial from mulesoft) Input payload { "username": "WASP", "name": "Lisbeth", "surname": "Salander", "location": { "address": { "street": "Lundagatan", "number": 9 }, "city": "Stockholm", "country": "Sweden" } } Dataweave Transformation %dw 2.0 import * from dw :: util :: Values output json --- payload update "username" with lower($) update [ "location" , "address" , field( "street" )] with "Fiskargatan" output { "username" : "wasp" , "name" : "Lisbeth" , "surname" : "Salander" , "location" : { "address&

Dataweave 2.0 - Pluck

Image
 Pluck is useful converting HashMap/Object into array of Objects.  pluck  iterates over an object and returns an array of keys, values, or indices from the object.

Dataweave 2.0(2.7) - typeOf

Image
 How to determine if the variable or payload type is String, Array, Number , Boolean or Object  using typeOf Object: String Number: Boolean: Array: