
endOfLine - String Replace the OS default EOL. forceTextDelimiter - Boolean Set this option to true to wrap every data item and header in the textDelimiter. textDelimiter - String The character used to escape the text content if needed (default to "). rowDelimiter - String Change the file row delimiter. mapHeaders - Function Post-process headers after they are calculated with delimiters, example mapHeaders: (header) => header.replace(/foo\./, '').
rename - Array Used to set a custom header text, defaults to example. headers - Array Used to set a custom header order, defaults to example. fillTopRow - Boolean try filling top rows first for unpopular colums, defaults to false. fillGaps - Boolean Set this option if don't want to have empty cells in case of an object with multiple nested items (array prop), defaults to false Issue #22. headerPathString - String Used to create the propriety path, defaults to. To convert from CSVJSON back to JSON, use the companion tool CSVJSON to JSON.ĭror Harari: "The reason why I came up with CSVJSON was not to allow embedding of JSON objects in a CSV line, that's a nice benefit but my main reason was to have the very well defined encoding semantics of JSON (as per ) be used to describe CSV lines (just taking out the ).In order to get the most of out of this module, you can customize many parameters and functions. Wrap a line with square brackets and use JSON.parse() to convert to a JSON array. Parsing CSVJSON is done by processing one line at a time. Toggle the switch Output CSVJSON variant to output that format.ĬSVJSON format variant is not valid CSV however every value is valid JSON. More specifically, objects and arrays would not be wrapped in double quotes but output as is. The variant proposes that every CSV value be a valid JSON value.
Dror Harari proposed a variant called CSVJSON ( ). Make sure to pick that option if you are going to import the CSV file in Excel.ĬSV values are plain text strings. In French, Excel will expect a semi-colons instead of a comma. You can then copy (Ctrl+C) and paste (Ctrl+V) it into Excel. TSV or Tab Separated Values is used to store table data in the Clipboard. Often used as an interchange data format to represent table records, one per line. Alternatively, you can flatten nested arrays of objects as requested by Rogerio Marques in GitHub issue #3. By default, nested arrays or objects will simply be stringified and copied as is in each cell. JSON to CSV will convert an array of objects into a table. This function is available as a npm package.