nano-csv2json
Tiny CSV → JSON Lines converter — ~1 KB, zero deps. Single-file, CLI included. Auto-sniffs delimiter; headers optional. Perfect for code-golf, minimal containers, or just for fun.
✨ Features
- ✅ CSV → JSONL (one JSON per line)
- ✅ Auto-detect delimiter (
,,;,\t, …) - ✅ Uses header row if present;
--no-header→ keys:c1,c2,... - ✅ Zero dependencies, single tiny file
🚀 Usage
# Local (from repo)
python app_min.py data.csv
python app_min.py --no-header data_nohdr.csv
After installing:
# CLI
pip install nano-csv2json
nano-csv2json data.csv > out.jsonl
type data.csv | nano-csv2json # Windows
cat data.csv | nano-csv2json # Linux/macOS
Output is JSON Lines (newline-separated JSON objects).
🤓 Why so small?
- Uses only the stdlib:
csv,json,io— no pandas. - Auto-detects delimiter with
csv.Sniffer()(comma/semicolon/tab…). - Streams to JSON Lines (one JSON per line) — no in-memory data frames.
- Header row →
csv.DictReader;--no-header→c1,c2,...keys viacsv.reader. - Single tiny file + tiny CLI: perfect for scripts, containers, CI.
🎉 Fun Ideas
- Pretty-print JSONL
nano-csv2json data.csv | python -m json.tool
- Filter with jq
nano-csv2json data.csv | jq -r 'select(.status=="ok")'
- STDIN piping
curl -s https://example.com/data.csv | nano-csv2json > out.jsonl
# Windows
Invoke-WebRequest https://example.com/data.csv -UseBasicParsing | nano-csv2json > out.jsonl
- Semicolon/TSV auto-sniff
nano-csv2json data_semicolon.csv > out.jsonl
nano-csv2json data.tsv > out.jsonl
- No header → synthetic keys
nano-csv2json --no-header raw.csv | head -1
# {"c1":"val1","c2":"val2",...}
- Compress on the fly
nano-csv2json data.csv | gzip > out.jsonl.gz
- First N records
nano-csv2json data.csv | head -100 > sample.jsonl
Tip: Need a single JSON array? Collect lines with jq: nano-csv2json data.csv | jq -s '.' > array.json
📜 License
MIT © 2025
Metadata
Release files for nano-csv2json 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nano_csv2json-0.1.0.tar.gz | 3.5 kB | Without provenance | Details for nano_csv2json-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nano_csv2json-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for nano_csv2json-0.1.0-py3-none-any.whl |
Total release size: 7.5 kB
Release files / nano_csv2json-0.1.0.tar.gz
| Download URL | nano_csv2json-0.1.0.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
157757b12ff0752e2c1a0c4d9fc54f9ad759495fbfc8addd974b28e85bad6b8f
|
|
BLAKE2b-256 checksum How to use checksums |
c6d0b39d11ae5609573dcc59b3873bd6bc930cc6393a2d1389adbe953eddc8ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / nano_csv2json-0.1.0-py3-none-any.whl
| Download URL | nano_csv2json-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3136f4fc061ad1487d283d52b0a9eeecfe23e9286059759e6eb29a6f5f332d87
|
|
BLAKE2b-256 checksum How to use checksums |
4a128c7d71630005636058728f6112681ba75e52ee23d73c5c18937b146d5387
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Security for nano-csv2json 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.