Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/neroist/c2v
A tool that converts CSV files into JSON.
https://github.com/neroist/c2v
cli conversion csv csv-parser json nim nim-lang
Last synced: about 19 hours ago
JSON representation
A tool that converts CSV files into JSON.
- Host: GitHub
- URL: https://github.com/neroist/c2v
- Owner: neroist
- License: mit
- Created: 2023-06-17T04:36:13.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-06-17T13:26:33.000Z (over 1 year ago)
- Last Synced: 2024-12-12T12:06:51.703Z (about 2 months ago)
- Topics: cli, conversion, csv, csv-parser, json, nim, nim-lang
- Language: Nim
- Homepage:
- Size: 19.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# c2v
A tool that converts CSV files into JSON. Supports four different types of
JSON outputs:- Default: Outputs array of objects, each object representing a CSV row.
Each key is a header and the corresponding value being the value of that
header in the represented row.
- Hash/Keyed: Output an object instead of an array. First column is used as
hash key.
- Array: Outputs an array of arrays, each nested array representing a CSV row.
- Column Array: Similar to Array, except it outputs an object, with each
key representing a CSV header and each corresponding value being the array
of values under the header.## Usage
```text
Usage:
c2v [optional-params] [filename: string...]
Convert CSV file to JSON
Options:
-h, --help print this cligen-erated help
--help-syntax advanced: prepend,plurals,..
-v, --version bool false print version
-s=, --sep= char ',' The character used to separate fields in the CSV file.
-q=, --quote= char '\"' The character to quote fields containing special characters like `separator`, `quote` or new-line characters. '0' (nul) disables the parsing of quotes.
-e=, --escape= char '\x00' Removes any special meaning from the specified character; '0' disables escaping; if escaping is disabled and `quote` is not '0', two `quote` characters are
parsed as one literal `quote` character.
--skip bool true Whether or not to skip whitespace immediately following the separator.
-o=, --out= string "" The output filename. By default is it set to the input filename with the file extension changed to ".json"
-p, --print bool false Whether or not to print the produced JSON to stdout. If this is true then `out` is ignored.
--output= string "default" The type of JSON output to produce. Accepted values: default, hash, array, colarr.
-m, --minify bool false Whether or not to minify the JSON output. If true, the `indent` option is ignored.
-i=, --indent= int 4 How much, in spaces, to indent the JSON output. If `minify` is true, this option is ignored.
```## Examples
Example CSV data to test n play around with in C2V are found in the
[`examples/`](examples/) directory.