Fast and powerful CSV (delimited text) parser that gracefully handles large files and malformed input
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Matthew Holt 38fa3a4358 Better regex matching 11 years ago
LICENSE Initial commit 11 years ago
README.md Explaining results in docs 11 years ago
jquery.parse.js Better regex matching 11 years ago
jquery.parse.min.js Not allowing " or \n as delimiter 11 years ago
parse.jquery.json Added plugin manifest 11 years ago

README.md

jquery.parse

Robust, efficient CSV parsing (with nearly any delimiting character)

Basic usage

results = $.parse(csvString, {
	delimiter: "\t",
	header: true
});

The default delimiter is , but can be set to anything anything except " or \n.

By default, a header row is expected. The output and error handling depends on whether you include a header row with your data.

If header: true, the output looks like:

{
	errors: [
		// errors, if any (parsing should not throw exceptions)
	],
	results: {
		fields: [
			// field names from the header row
		],
		rows: [
			// objects, where each field value is keyed to the field name
		]
	}
}

If header: false, the output looks like:

{
	errors: [
		// errors, if any (parsing should not throw exceptions)
	],
	results: [
		// each row is itself an array of values separated by delimiter
	]
}

Errors look like:

{
	message: "",	// Human-readable message
	line: 0,		// Line of original input
	row: 0,			// Row index where error was
	index: 0		// Character index within original input
}