I have a CSV file which sends records in the following format:
John,Smith,presentation|researcher|developer,js@email.com,07891234567
I need to take each record and map them to a list of the following JSON object:
[
{
"firstName": "John",
"surname": "Smith",
"skills":
[
"presentation",
"developer",
"researcher"
]
"email": "js@email.com",
"phone": "07891234567"
}
[
My problem is that how do you split the address text string and populate the address object along with the other fields using Dataweave and the Transform message component in Mule 3.8.1?
Thanks
You can use the splitBy to get what you are wanting.
%dw 1.0
%input payload application/csv
%output application/json
---
payload map {
firstname: $.firstname,
lastname: $.lastname,
skills: $.skills splitBy ('|'),
email: $.email,
phone: $.phone
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.