Search code examples
dataweavemulesoft

dataweave expression to map json to flat file


Im new to mulesoft, trying to extract database to a flatfile via json in mulesoft. Please help in writing dataweave expression for converting json payload to flatfile.

mule flow:

and my flat file schema is:

StudentDetailsSchema.ffd

With the above I'm getting exception like:

enter image description here


Solution

  • It's expecting a map not an array(map in dataweave returns an array) If you want to ouptut an array, you need to modify your FFD schema so that it know its an array, using:

      - { idRef: 'PersonalInfo', count: '>1' } 
      - { idRef: 'CourseDetails', count: '>1' } 
    

    That will fix your transform.