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
8ef9ee3a4f
|
11 years ago | |
---|---|---|
LICENSE | 11 years ago | |
README.md | 11 years ago | |
jquery.parse.js | 11 years ago | |
jquery.parse.min.js | 11 years ago | |
parse.jquery.json | 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
}