Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

1337kid/convcsv2json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

10 Commits

Repository files navigation

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"
}
]

About

Convert a CSV file into JSON format based on CSV headers

Topics

Resources

Readme

License

GPL-3.0 license

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

Languages