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"
}
]
Metadata
Release files for convcsv2json 1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| convcsv2json-1.6.tar.gz | 14.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| convcsv2json-1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.9 kB
Release files / convcsv2json-1.6.tar.gz
| Download URL | convcsv2json-1.6.tar.gz |
|---|---|
| Size | 14.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2caa2f6a7797fa80ba86d8b9f7c66978fb31459902e9ecfcb82a233a51ff0aa4
|
|
BLAKE2b-256 checksum How to use checksums |
9088a5b5bce0c6dbf137b89b74dd48a74b456541bde15ce13b4bc2046a36e750
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|
Release files / convcsv2json-1.6-py3-none-any.whl
| Download URL | convcsv2json-1.6-py3-none-any.whl |
|---|---|
| Size | 14.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f75aa9a2dd9250639e7c4d3b34c92e5032ad0e5dbfdfbad01de3be23c79d7671
|
|
BLAKE2b-256 checksum How to use checksums |
c9b2d23eb7316a57c395c06fe8d638dff462e15195f842b7fb02d81fe37b8e18
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|