title: csv to json file format
body: <p>I want to convert my csv file into .json format using c#. here what i have tried:</p>
  
  <pre><code>var lines = @"text,intentName,entityLabels
          1,2,null
          2,1,null".Replace("\r", "").Split('\n');
  
      var csv = lines.Select(l =&gt; l.Split(',')).ToList();
  
      var headers = csv[0];
      var dicts = csv.Skip(1).Select(row =&gt; Enumerable.Zip(headers, row, 
  Tuple.Create).ToDictionary(p =&gt; p.Item1, p =&gt; p.Item2)).ToArray();
  
      string json = new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(dicts);
      Result1.Text = json;
  </code></pre>
  
  <p>The result is :</p>
  
  <pre><code>[
   {
  "text":" 1",
  "intentName":"2",
  "entityLabels":"null"
  },
   {
  "text":"2",
  "intentName":"1",
  "entityLabels":"null"
  }
  ] 
  </code></pre>
  
  <p>it almost like I expected, however I want to make if the entityLabels column is null, then it replace into []. so the output that I expecting is:</p>
  
  <pre><code>[
   {
  "text":" 1",
  "intentName":"2",
  "entityLabels":[]
  },
   {
  "text":"2",
  "intentName":"1",
  "entityLabels":[]
  }
  ] 
  </code></pre>
  
  <p>anyone know how to do it?</p>