Convert a CSV file into JSON format based on CSV headers
Project description
CONVCSV2JSON
Convert a CSV file into JSON format based on CSV headers
pip install convcsv2json
Usage
from convcsv2json import csv2json
data=csv2json(
'sample.csv', # CSV filename
intend=4, # JSON intendation
numbered=True # Set JSON data in numbered format or not
)
print(data.conv()) # Print in JSON format
data.export('export.json') # Export the data into a JSON file
"intend" and "numbered" parameters are optional. By default, "intend" is set as None and "numbered" is set as False
from convcsv2json import csv2json
print(csv2json('sample.csv',4).conv())
Sample CSV
name,age
kewldog,12
kewlcat,23
Generated JSON
[
{
"name": "kewl",
"age": "344"
},
{
"name": "noice",
"age": "456"
}
]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
convcsv2json-1.5.tar.gz
(14.4 kB
view hashes)
Built Distribution
convcsv2json-1.5-py3-none-any.whl
(14.6 kB
view hashes)
Close
Hashes for convcsv2json-1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d72504f8dc2452d55bd6760758d5b603fd27f7fd1f528841ecf106b25b4b34f |
|
MD5 | dd8e64647d98d4f7e4841f6191894846 |
|
BLAKE2b-256 | 75b9dd87e23b2acef993afc4b55fdca1f2bfb1f3c0a023fce06ae172b976f64b |