title: How to Read CSV file in java using Jackson Library ,JSON
body: <p>How to Read CSV file from a path in java using Jackson Library. And Parse Using 
    <strong>CsvSchema</strong>,    <strong>ObjectReader</strong>  ,  <strong>CsvMapper</strong>. ANd then convert it to JSON object USing Jackson library. pLease HELP.</p>
  
  <pre><code>private void testCsvRead() throws Exception 
   {
     String FILE_NAME = "G://Read folder/output.csv";
     System.out.println("read csv");
  
     ClassLoader classLoader = getClass().getClassLoader();
  
     //-------------*****I am getting error here*****------------///
  
     File file = new File(classLoader.getResource(FILE_NAME).getFile());
  
     &lt;-------------**********------------/
     CsvSchema schema = CsvSchema.builder().addColumn("parentCategoryCode").addColumn("code").addColumn("name").addColumn("description").build();
     CsvMapper mapper = new CsvMapper();
  
  
     ObjectReader oReader = mapper.readerFor(OfferTemplateCategory.class).with(schema);
  
  
     try (Reader reader = new FileReader(file)) {
      MappingIterator mi = oReader.readValues(reader);
  
         while (mi.hasNext()) 
         {
           System.out.println(mi.next());
         }
  
    }
  }
  </code></pre>
  
  <p>I am getting error on this line(See above)</p>
  
  <pre><code>File file = new File(classLoader.getResource(FILE_NAME).getFile());
  </code></pre>
  
  <p>This is the error---></p>
  
  <pre><code>java.lang.NullPointerException
  at CSVtester.CsvTest.testCsvRead(CsvTest.java:39)
  at CSVtester.CsvTest.main(CsvTest.java:26)
  </code></pre>