0

I have a CSV file which sends records in the following format:

John,Smith,presentation|researcher|developer,[email protected],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": "[email protected]",
      "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

1 Answer 1

2

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
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.