88 lines
4.3 KiB
JSON
88 lines
4.3 KiB
JSON
|
{
|
||
|
"commands": {
|
||
|
"parse": "(Default)Parse a csv file to json",
|
||
|
"version": "Show version of current csvtojson"
|
||
|
},
|
||
|
"options": {
|
||
|
"--output":{
|
||
|
"desc": "The format to be converted to. \"json\" (default) -- convert csv to json. \"csv\" -- convert csv to csv row array. \"line\" -- convert csv to csv line string",
|
||
|
"type": "string"
|
||
|
},
|
||
|
"--delimiter": {
|
||
|
"desc": "delimiter to separate columns. Possible to give an array or just use 'auto'. default comma (,). e.g. --delimiter=# --delimiter='[\",\",\";\"]' --delimiter=auto",
|
||
|
"type": "~object"
|
||
|
},
|
||
|
"--quote": {
|
||
|
"desc": "quote surrounding a column content containing delimiters. To turn off quote, please use 'off' --quote=off. default double quote (\"). e.g. chage to hash: --quote=# ",
|
||
|
"type": "string"
|
||
|
},
|
||
|
"--trim": {
|
||
|
"desc": "Indicate if parser trim off spaces surrounding column content. e.g. \" content \" will be trimmed to \"content\". Default: true",
|
||
|
"type": "boolean"
|
||
|
},
|
||
|
"--checkType": {
|
||
|
"desc": "This parameter turns on and off whether check field type. default is false.",
|
||
|
"type": "boolean"
|
||
|
|
||
|
},
|
||
|
"--ignoreEmpty": {
|
||
|
"desc": "This parameter turns on and off whether ignore empty column values while parsing. default is false",
|
||
|
"type": "boolean"
|
||
|
},
|
||
|
"--noheader": {
|
||
|
"desc": "Indicating csv data has no header row and first row is data row. Default is false",
|
||
|
"type": "boolean"
|
||
|
},
|
||
|
"--headers": {
|
||
|
"desc": "An array to specify the headers of CSV data. If --noheader is false, this value will override CSV header. Default: null. Example: --headers='[\"my field\",\"name\"]'",
|
||
|
"type": "object"
|
||
|
},
|
||
|
"--flatKeys": {
|
||
|
"desc": "Don't interpret dots (.) and square brackets in header fields as nested object or array identifiers at all (treat them like regular characters for JSON field identifiers). Default: false.",
|
||
|
"type": "boolean"
|
||
|
},
|
||
|
"--maxRowLength": {
|
||
|
"desc": "the max character a csv row could have. 0 means infinite. If max number exceeded, parser will emit \"error\" of \"row_exceed\". if a possibly corrupted csv data provided, give it a number like 65535 so the parser wont consume memory. default: 10240",
|
||
|
"type": "number"
|
||
|
},
|
||
|
"--checkColumn": {
|
||
|
"desc": "whether check column number of a row is the same as headers. If column number mismatched headers number, an error of \"mismatched_column\" will be emitted.. default: false",
|
||
|
"type": "boolean"
|
||
|
},
|
||
|
"--eol": {
|
||
|
"desc": "Explicitly specify the end of line character to use.",
|
||
|
"type": "string"
|
||
|
},
|
||
|
"--quiet": {
|
||
|
"desc": "If any error happens, quit the process quietly rather than log out the error. Default is false.",
|
||
|
"type": "boolean"
|
||
|
},
|
||
|
"--escape":{
|
||
|
"desc":"escape character used in quoted column. Default is double quote (\") according to RFC4108. Change to back slash (\\) or other chars for your own case.",
|
||
|
"type":"string"
|
||
|
},
|
||
|
"--ignoreColumns": {
|
||
|
"desc": "RegExp matched columns to ignore from input. e.g. --ignoreColumns=/(name|age)/ ",
|
||
|
"type": "string"
|
||
|
},
|
||
|
"--includeColumns": {
|
||
|
"desc": "RegExp matched columns to include from input. e.g. --includeColumns=/(name|age)/ ",
|
||
|
"type": "string"
|
||
|
},
|
||
|
"--colParser": {
|
||
|
"desc": "Specific parser for columns. e.g. --colParser='{\"col1\":\"number\",\"col2\":\"string\"}'",
|
||
|
"type": "~object"
|
||
|
},
|
||
|
"--alwaysSplitAtEOL":{
|
||
|
"desc": "Always interpret each line (as defined by eol) as a row. This will prevent eol characters from being used within a row (even inside a quoted field). This ensures that misplaced quotes only break on row, and not all ensuing rows.",
|
||
|
"type": "boolean"
|
||
|
}
|
||
|
},
|
||
|
"examples": [
|
||
|
"csvtojson < csvfile",
|
||
|
"csvtojson <path to csvfile>",
|
||
|
"cat <csvfile> | csvtojson",
|
||
|
"csvtojson <csvfilepath> --checkType=false --trim=false --delimiter=#"
|
||
|
]
|
||
|
}
|