dataweave

How to loop and combine as one in Mule Dataweave

浪子不回头ぞ 提交于 2020-06-16 18:02:04
问题 I have request of json and expected response one as mentioned below. It need to groupBy clientItemCode and i'm halfway somewhere stuck to loop around in same. Used both MapObject and reduce combination of function. Any help will be appreciated. [ { "ClientCode": "1", "ClientItemCode": "245", "LocationId": "CLOSED" }, { "ClientCode": "1", "ClientItemCode": "245", "LocationId": "OPEN" }, { "ClientCode": "2", "ClientItemCode": "245", "LocationId": "CHECKOUT" }, { "ClientCode": "2",

How to loop and combine as one in Mule Dataweave

梦想与她 提交于 2020-06-16 18:01:07
问题 I have request of json and expected response one as mentioned below. It need to groupBy clientItemCode and i'm halfway somewhere stuck to loop around in same. Used both MapObject and reduce combination of function. Any help will be appreciated. [ { "ClientCode": "1", "ClientItemCode": "245", "LocationId": "CLOSED" }, { "ClientCode": "1", "ClientItemCode": "245", "LocationId": "OPEN" }, { "ClientCode": "2", "ClientItemCode": "245", "LocationId": "CHECKOUT" }, { "ClientCode": "2",

How to loop and combine as one in Mule Dataweave

|▌冷眼眸甩不掉的悲伤 提交于 2020-06-16 17:57:08
问题 I have request of json and expected response one as mentioned below. It need to groupBy clientItemCode and i'm halfway somewhere stuck to loop around in same. Used both MapObject and reduce combination of function. Any help will be appreciated. [ { "ClientCode": "1", "ClientItemCode": "245", "LocationId": "CLOSED" }, { "ClientCode": "1", "ClientItemCode": "245", "LocationId": "OPEN" }, { "ClientCode": "2", "ClientItemCode": "245", "LocationId": "CHECKOUT" }, { "ClientCode": "2",

How to remove empty array objects from dataweave response

为君一笑 提交于 2020-06-13 11:24:31
问题 I have a use case to remove empty json objects from dataweave response. The dw response after transformation will be like { "remuneration": { "allowance": [ { } ] }, "identifiers": { "employeeId": "1", "id": "E001", "payrollId": "901", "username": "sample" }, "employment": { } } I want the empty objects to be removed from the output. Expected output: { "identifiers": { "employeeId": "1", "id": "E001", "payrollId": "901", "username": "sample" } } DWL script %dw 1.0 %output application/json

How to convert ManagedCursorStreamProvider to JSOn object in mule 4

╄→尐↘猪︶ㄣ 提交于 2020-05-09 05:18:29
问题 How to convert ManagedCursorStreamProvider to Json object in mule. I have written a java method which takes the Json Object as input Request Payload: { a: "one", b : "two"} Invoke static arg0 : payload Java Function called using invoke static public static func(JsonObject json){ } I am getting the following error: Expected arguments are [com.google.gson.JsonObject jsonObject] and invocation was attempted with arguments [org.mule.runtime.core.internal.streaming.bytes

Dataweave Always output JSON number with two decimal places

耗尽温柔 提交于 2020-01-17 06:45:58
问题 I've got the following number coming through via xml in Dataweave. <b:AmountValue>180.90</b:AmountValue> Using Dataweave I am trying to output a corresponding json number with two decimal places (to represent currency). Here is what my Dataweave expression looks like... amount: $.AmountValue as :number as :string {format: ".00"} as :number The output json is losing the trailing zero. i.e. "amount":180.9 How can I change my Dataweave expression to always have two decimal places? Or perhaps I'm