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.json()) # 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).json())
Sample CSV
name,age
kewldog,12
kewlcat,23
Generated JSON
[
{
"name": "kewldog",
"age": "12"
},
{
"name": "kewlcat",
"age": "23"
}
]
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.6.tar.gz
(14.4 kB
view hashes)
Built Distribution
convcsv2json-1.6-py3-none-any.whl
(14.6 kB
view hashes)
Close
Hashes for convcsv2json-1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f75aa9a2dd9250639e7c4d3b34c92e5032ad0e5dbfdfbad01de3be23c79d7671 |
|
MD5 | 8da78713c6009af80cea23888c21c197 |
|
BLAKE2b-256 | c9b2d23eb7316a57c395c06fe8d638dff462e15195f842b7fb02d81fe37b8e18 |