function csv2json( csv ) {
	var nfields;
	var fields;
	var nrows;
	var rows;
	var out;
	var r;
	var o;
	var i;
	var j;

	out = [];
	rows = csv.split( RE_EOL );
	nrows = rows.length;
	if ( nrows === 0 ) {
		return out;
	}
	// We assume that the first row is a header row:
	fields = rows[ 0 ].split( ',' );
	nfields = fields.length;

	for ( i = 1; i < nrows; i++ ) {
		r = rows[ i ];

		// We assume simple CSV rows:
		r = r.substring( 1, r.length-1 ).split( '","' );

		// Assemble the data object...
		o = {};
		for ( j = 0; j < nfields; j++ ) {
			o[ fields[ j ] ] = r[ j ];
		}

		// Append to the output data array:
		out.push( o );
	}
	return out;
}
/**
* Converts a CSV string to a JSON array.
*
* @private
* @param {string} csv - CSV string
* @returns {Array<Object>} JSON array
*/
Converts a CSV string to a JSON array.
Converts a CSV string to a JSON array .
function csv2json( csv ) {
	var nfields;
	var fields;
	var nrows;
	var rows;
	var out;
	var r;
	var o;
	var i;
	var j;
	out = [];
	rows = csv.split( RE_EOL );
	nrows = rows.length;
	if ( nrows === 0 ) {
		return out;
	}
	fields = rows[ 0 ].split( ',' );
	nfields = fields.length;
	for ( i = 1; i < nrows; i++ ) {
		r = rows[ i ];
		r = r.substring( 1, r.length-1 ).split( '","' );
		o = {};
		for ( j = 0; j < nfields; j++ ) {
			o[ fields[ j ] ] = r[ j ];
		}
		out.push( o );
	}
	return out;
}
function csv2json ( csv ) { var nfields ; var fields ; var nrows ; var rows ; var out ; var r ; var o ; var i ; var j ; out = [ ] ; rows = csv . split ( RE_EOL ) ; nrows = rows . length ; if ( nrows === 0 ) { return out ; } fields = rows [ 0 ] . split ( ',' ) ; nfields = fields . length ; for ( i = 1 ; i < nrows ; i ++ ) { r = rows [ i ] ; r = r . substring ( 1 , r . length - 1 ) . split ( '","' ) ; o = { } ; for ( j = 0 ; j < nfields ; j ++ ) { o [ fields [ j ] ] = r [ j ] ; } out . push ( o ) ; } return out ; }
Converts a CSV string to a JSON array.
Converts a CSV string to a JSON array .
// We assume that the first row is a header row: // We assume simple CSV rows: // Assemble the data object... // Append to the output data array: