Input from text file:
ID|ACTION|IID|SPK|DSI|OLID|NLD
1 | M | 1 | 1 | 1 | 1 | 1
Expected output:
{
"source": "PM",
"Timestamp": "4/10/2018 11:44:55 AM",
"tes":{
"id": 1,
"ac": "M",
"test": "1",
"key": "1",
"id": "1",
"nid": "1"
}
}
I tried below code snippet in dataweave but i am getting exception during runtime.
<ee:transform doc:name="Transform Message" doc:id="2a7de32c-1b84-4419-826f-8099ce1dc241" >
<ee:message >
<ee:set-payload ><![CDATA[%dw 2.0
output application/json
input payload text/csv
---
payload map{
source:"PM",
"Timestamp": now() as String {format: "MM/dd/YYYY hh:mm:ss a"},
"tes":{
"id":$.ID,
"action":$.ACTION,
"IID":$.IID,
"SPK":$.SPK,
"DSI":$.DSI,
"OLID":$.OLID,
"NID":$.NLD
}
}
]]></ee:set-payload>
</ee:message>
</ee:transform>
Message : "You called the function 'map' with these arguments: 1: String ("ID|ACTION|IID|SPK|DSI|OLID|NLD...) 2: Function (($:Any, $$:Any) -> ???)
But it expects arguments of these types: 1: Array 2: Function
5| payload map{ | ... 11| }
Trace: at map (line: 5, column: 3) at main (line: 5, column: 11)" evaluating expression: "%dw 2.0 output application/json indent = true input payload text/csv