options.json
4.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
{
"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. default double quote (\"). e.g. --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=#"
]
}