$$csvparse
Converts a CSV string into an array of objects/arrays
Usage​
{
"$$csvparse": "...",
"no_headers": false,
"separator": ",",
"names": [ /* names */ ]
}
"$$csvparse([no_headers],[separator],[names]):{input}"
Returns​
string
Arguments​
Argument | Type | Values | Required / Default Value | Description |
---|---|---|---|---|
no_headers | boolean | false /true | false | Whether to treat the first row as object keys |
separator | string | false /true | "," | Use an alternative field separator |
names | string[] | (Names taken from the first object) | Names of fields of input arrays (by indices) or objects (can sift if provided less names than there are in the objects provided) |
Examples​
Input
Definition
Output
a
","
{
"$$csvparse": "$"
}
[{ "a": "," }]
a
""""
{
"$$csvparse": "$"
}
[{ "a": "\"" }]
1,2
3,4
{
"$$csvparse": "$",
"no_headers": true
}
[
["1","2"],
["3","4"]
]
a
","
"$$csvparse:$"
[{ "a": "," }]
a
""""
"$$csvparse:$"
[{ "a": "\"" }]
1,2
3,4
"$$csvparse(true):$"
[
["1","2"],
["3","4"]
]