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 details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file convcsv2json-1.6.tar.gz.
File metadata
- Download URL: convcsv2json-1.6.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2caa2f6a7797fa80ba86d8b9f7c66978fb31459902e9ecfcb82a233a51ff0aa4
|
|
| MD5 |
2ee95497eed0cdd67d52c45148ae28b9
|
|
| BLAKE2b-256 |
9088a5b5bce0c6dbf137b89b74dd48a74b456541bde15ce13b4bc2046a36e750
|
File details
Details for the file convcsv2json-1.6-py3-none-any.whl.
File metadata
- Download URL: convcsv2json-1.6-py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f75aa9a2dd9250639e7c4d3b34c92e5032ad0e5dbfdfbad01de3be23c79d7671
|
|
| MD5 |
8da78713c6009af80cea23888c21c197
|
|
| BLAKE2b-256 |
c9b2d23eb7316a57c395c06fe8d638dff462e15195f842b7fb02d81fe37b8e18
|