Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

convcsv2json

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

convcsv2json

Convert a CSV file into JSON format based on CSV headers

  • 1.6
  • Source
  • PyPI
  • Socket score

Maintainers
1

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

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc