title: CSV TO JSON using dataweave
body: <p><strong>Please refer this dataweave window image :- <a href="http://i.stack.imgur.com/3xjqT.png" rel="nofollow">dataweave window image</a></strong></p>
  
  <p>I am trying to transform a CSV TO JSON using dataweave but even for the simplest of transformations it is creating a null tag automatically. I can see that in the preview window. When I run this application I am getting this error 
  *</p>
  
  <blockquote>
    <p>Exception stack is:
    1. 452 (java.lang.ArrayIndexOutOfBoundsException)   com.mulesoft.weave.reader.CharArraySourceReader:21 (null)
    2. 452 (java.lang.ArrayIndexOutOfBoundsException). Message payload is of type: WeaveMessageProcessor$WeaveOutputHandler
    (org.mule.api.MessagingException)<br>
    org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor:32</p>
    
    <p>******************************************************************************** Root Exception stack trace: java.lang.ArrayIndexOutOfBoundsException:
    452   at
    com.mulesoft.weave.reader.CharArraySourceReader.lookAheadAscii(CharArraySourceReader.scala:21)
      at
    com.mulesoft.weave.reader.csv.parser.CSVParser.parse(CSVParser.scala:132)
      at
    com.mulesoft.weave.reader.csv.parser.CSVParser.elementAt(CSVParser.scala:61)
      at
    com.mulesoft.weave.reader.csv.parser.CSVParser.contains(CSVParser.scala:38)
      at
    com.mulesoft.weave.reader.csv.CSVRecordsValue$$anon$1.hasNext(CSVReader.scala:58)
      at scala.collection.Iterator$class.toStream(Iterator.scala:1188)    at
    com.mulesoft.weave.reader.csv.CSVRecordsValue$$anon$1.toStream(CSVReader.scala:56)</p>
  </blockquote>
  
  <p>This is the sample csv I am using</p>
  
  <pre><code>SpreadsheetKeyEmployee,Position,EffectiveDate,BonusPlan,Amount,Currency,IgnorePlanAssignment
  1,18211,2016-05-01,BONUS_PLAN1,150,USD
  2,18212,2016-05-01,BONUS_PLAN2,150,USD
  3,18213,2016-05-01,BONUS_PLAN3,150,USD
  4,18214,2016-05-01,BONUS_PLAN4,150,USD
  </code></pre>
  
  <p>I think i might be doing some mistake with the reader configuratuion (for csv) there is a similar issue discussed in the forum but this isnt helping either    <a href="https://forums.mulesoft.com/questions/36378/dataweave-example-of-csv-to-json.html" rel="nofollow">https://forums.mulesoft.com/questions/36378/dataweave-example-of-csv-to-json.html</a></p>