index.js
function csv2json(csvData) {
  var result = {};
  var csvLines = csvData.toString().split('\n');
  for (var i in csvLines) {
    var fields = splitCsvLine(csvLines[i]);
    if (fields.length) {
      var key = '';
      for (var k = 0; k < fields.length - 1; k++) {
        if (fields[k].length) {
          key += '.' + fields[k];
        }
      }
      result[key.substr(1)] = fields[fields.length - 1];
    }
  }
  return result;
}
function csv2json(csvData) {
  var result = {};
  var csvLines = csvData.toString().split('\n');
  for (var i in csvLines) {
    var fields = splitCsvLine(csvLines[i]);
    if (fields.length) {
      var key = '';
      for (var k = 0; k < fields.length - 1; k++) {
        if (fields[k].length) {
          key += '.' + fields[k];
        }
      }
      result[key.substr(1)] = fields[fields.length - 1];
    }
  }
  return result;
}
function csv2json ( csvData ) { var result = { } ; var csvLines = csvData . toString ( ) . split ( '\n' ) ; for ( var i in csvLines ) { var fields = splitCsvLine ( csvLines [ i ] ) ; if ( fields . length ) { var key = '' ; for ( var k = 0 ; k < fields . length - 1 ; k ++ ) { if ( fields [ k ] . length ) { key += '.' + fields [ k ] ; } } result [ key . substr ( 1 ) ] = fields [ fields . length - 1 ] ; } } return result ; }
Simple conversion helper to get a json file from a csv file.
@param {String} csvData
@returns {Object}
Simple conversion helper to get a json file from a csv file .