A very simple CSV to JSON conversion script with command-line arguments.
The script takes an input CSV file in its same directory and outputs a specified JSON file as follows:
python csv_json.py -i inputCSVfile -o outputJSONfile --indent 4
File extensions should be left out of the naming parameters.
The input and output files must be given; see below for additional optional parameters.
Argument | Default | Description |
---|---|---|
-i , --input | Declare the CSV to be read, without the file extension. | |
-o , --output | Declare the JSON to be written, without the file extension. | |
--indent | 0 | Optional, specify a new line indentation. |
-d , --delimiter | , | Optional, specify a delimiter character. |
- Checking and/or validating encoding, escape character
- Allow usage across different directories
- Write tests