dataweave

Matching Array values in mule 4 using dataweave

a 夏天 提交于 2020-12-14 23:45:12
问题 I am trying to match the specific value from input payload using dataweave. Input: { "drives": [{ "id": "0AEzOyzyCb7Uk9PVA", "name": "SFJob-2020-10" }, { "id": "0AMEHi1wsq-8FUk9PVA", "name": "SFJobs-2020-11" } ], "nextPageToken": "~!!~AI9FV7RV4uSXy20zpCBTP2LFWCXS0c" }, { "drives": [{ "id": "0AEz3mOyzyCb7Uk9PVA", "name": "Dev2020-10" }, { "id": "0AMEHi1wsq-8FUk9PVA", "name": "Dev2020-11" }], "nextPageToken": "~!!~AI9P2LFWCXS0c" } how can i check whether value "Dev2020-10" is present or not. i

Matching Array values in mule 4 using dataweave

孤人 提交于 2020-12-14 23:39:22
问题 I am trying to match the specific value from input payload using dataweave. Input: { "drives": [{ "id": "0AEzOyzyCb7Uk9PVA", "name": "SFJob-2020-10" }, { "id": "0AMEHi1wsq-8FUk9PVA", "name": "SFJobs-2020-11" } ], "nextPageToken": "~!!~AI9FV7RV4uSXy20zpCBTP2LFWCXS0c" }, { "drives": [{ "id": "0AEz3mOyzyCb7Uk9PVA", "name": "Dev2020-10" }, { "id": "0AMEHi1wsq-8FUk9PVA", "name": "Dev2020-11" }], "nextPageToken": "~!!~AI9P2LFWCXS0c" } how can i check whether value "Dev2020-10" is present or not. i

Tail Recursion in Dataweave

醉酒当歌 提交于 2020-12-13 13:20:06
问题 Is there a way to take a recursive function (like the following) and make it tail recursive? I have an input like this: { "message": "Test ", "read": [ { "test": " t " } ] } and this Dataweave function fun trimWS(item) = item match { case is Array -> $ map trimWS($) case is Object -> $ mapObject { ($$): $ match { case is String -> trim($) case is Object -> trimWS($) case is Array -> $ map trimWS($) else -> $ } } case is String -> trim($) else -> $ } 回答1: I reworked a little bit your existing

Tail Recursion in Dataweave

眉间皱痕 提交于 2020-12-13 13:15:32
问题 Is there a way to take a recursive function (like the following) and make it tail recursive? I have an input like this: { "message": "Test ", "read": [ { "test": " t " } ] } and this Dataweave function fun trimWS(item) = item match { case is Array -> $ map trimWS($) case is Object -> $ mapObject { ($$): $ match { case is String -> trim($) case is Object -> trimWS($) case is Array -> $ map trimWS($) else -> $ } } case is String -> trim($) else -> $ } 回答1: I reworked a little bit your existing

Recursivly traverse and flatten JSON object in DataWeave

空扰寡人 提交于 2020-12-13 03:31:17
问题 I want to traverse and flatten a big JSON file that has following structure showing a product hierarchie (think of it as navigation in an online shop): productGroups: [ { "key": "child 1" ... "childrenProductGroups": [ { "key": "child 1.1", ..., "childrenProductGroups": [] }, { "key": "child 1.2" ... "childrenProductGroups": [ { "key": "child 1.2.1", ..., "childrenProductGroups": [ { "key": "child 1.2.1.1", ..., childrenProductGroups": [ ... ] } ] }, { "key": "child 1.2.2", ...,

Recursivly traverse and flatten JSON object in DataWeave

丶灬走出姿态 提交于 2020-12-13 03:31:15
问题 I want to traverse and flatten a big JSON file that has following structure showing a product hierarchie (think of it as navigation in an online shop): productGroups: [ { "key": "child 1" ... "childrenProductGroups": [ { "key": "child 1.1", ..., "childrenProductGroups": [] }, { "key": "child 1.2" ... "childrenProductGroups": [ { "key": "child 1.2.1", ..., "childrenProductGroups": [ { "key": "child 1.2.1.1", ..., childrenProductGroups": [ ... ] } ] }, { "key": "child 1.2.2", ...,

Recursivly traverse and flatten JSON object in DataWeave

自作多情 提交于 2020-12-13 03:30:19
问题 I want to traverse and flatten a big JSON file that has following structure showing a product hierarchie (think of it as navigation in an online shop): productGroups: [ { "key": "child 1" ... "childrenProductGroups": [ { "key": "child 1.1", ..., "childrenProductGroups": [] }, { "key": "child 1.2" ... "childrenProductGroups": [ { "key": "child 1.2.1", ..., "childrenProductGroups": [ { "key": "child 1.2.1.1", ..., childrenProductGroups": [ ... ] } ] }, { "key": "child 1.2.2", ...,

Recursivly traverse and flatten JSON object in DataWeave

帅比萌擦擦* 提交于 2020-12-13 03:30:14
问题 I want to traverse and flatten a big JSON file that has following structure showing a product hierarchie (think of it as navigation in an online shop): productGroups: [ { "key": "child 1" ... "childrenProductGroups": [ { "key": "child 1.1", ..., "childrenProductGroups": [] }, { "key": "child 1.2" ... "childrenProductGroups": [ { "key": "child 1.2.1", ..., "childrenProductGroups": [ { "key": "child 1.2.1.1", ..., childrenProductGroups": [ ... ] } ] }, { "key": "child 1.2.2", ...,