Code Issues Releases

Releases

v1.0.0 — First stable release

v1.0.0 · August 28, 2026

main

csv-to-json v1.0.0 — first stable release

A lightweight, dependency-free CSV-to-JSON converter (Python 3.10+, stdlib only), usable as a CLI or as a library.

What it does

  • Type inference — CSV values are automatically cast to JSON integers, floats, booleans (true/yes, false/no), and null (empty cells); opt out with --no-type-inference
  • Nested key expansion — dot-notation headers like user.address.city become nested JSON objects via --expand-keys
  • Streamingstream_csv_to_json() yields one record at a time, so large files never need to fit in memory
  • Flexible input — accepts a file path, a raw CSV string, or stdin (-); custom delimiters via -d
  • Output options — pretty-printed by default, --compact for minified JSON, -o to write to a file

Usage

python src/csv_converter.py data.csv -o data.json --expand-keys
cat data.csv | python src/csv_converter.py - --compact

Verified against sample data covering type inference, nested expansion, empty-cell null handling, and compact output. MIT licensed.