A JSON to CSV converter for analysts who chronically can't parse JSON themselves.
Project description
chronically-needs-csv
For Kostas, the analyst blessed with mass amounts of Chronos (time), yet mysteriously none to spare for learning
json.load().
A JSON to CSV converter for people who chronically can't be bothered to parse JSON themselves.
Installation
pip install chronically-needs-csv
Or if you somehow mess that up too:
pip install git+https://github.com/JellevanE/chronically-needs-csv.git
Usage
Command Line
# The tool you'll chronically need
chronically-needs-csv data.json
# Or use the shorthand (named after you-know-who)
chronis data.json
# Specify output file
chronis data.json output.csv
# Use pipe delimiter for arrays (good for BigQuery, Konstantinos)
chronis data.json -d "|"
# Silent mode (if you can't handle the truth)
chronis data.json --silent
Python
from chronically_needs_csv import convert, json_to_csv_string
# Convert file to file
convert("data.json", "output.csv")
# Convert data directly
data = [{"name": "Chronis", "skill": "SQL", "json_knowledge": None}]
csv_string = json_to_csv_string(data)
Features
- Nested objects → flattened with dot notation (
user.address.city) - Arrays → joined with delimiter (default:
,) - Missing fields → empty cells (like your JSON knowledge)
- Any JSON shape → handled automatically
Example
Input (analysts.json):
[
{
"name": "Konstantinos",
"tools": {"primary": "BigQuery", "avoided": "Python"},
"skills": ["SQL", "asking friends for help"]
}
]
Output (analysts.csv):
name,tools.primary,tools.avoided,skills
Kostas,BigQuery,Python,"SQL, asking friends for help"
BigQuery Import
After converting, Kostas can finally do what he does best:
LOAD DATA INTO my_dataset.my_table
FROM FILES (
format = 'CSV',
uris = ['gs://bucket/data.csv']
);
FAQ
Q: Why is this package called "chronically-needs-csv"? A: Because someone chronically needs CSV files and his name happens to sound like Chronos. Coincidence? We think not.
Q: Can I use this even if my name isn't Konstantinos? A: Yes, but you'll still see messages about him. Consider it a feature.
Q: Why not just use pandas? A: Because then we couldn't make this joke.
Made with mild exasperation and mass amounts of love.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chronically_needs_csv-0.0.2.tar.gz.
File metadata
- Download URL: chronically_needs_csv-0.0.2.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c97b80ca21231f6794f74028b93dedf698e5a876460b2fda80de66a8d8b6aaf9
|
|
| MD5 |
0adbd3fa37f342c9c67b9252bce60c0c
|
|
| BLAKE2b-256 |
7b6e8a3ac56351adf36f98c6b87187f65ac480a06df665bc5d91f58a7d2c931e
|
File details
Details for the file chronically_needs_csv-0.0.2-py3-none-any.whl.
File metadata
- Download URL: chronically_needs_csv-0.0.2-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1548d0bd4fb959396fb61bb69323fbfb64b18038e125223783e8d982e04a48a
|
|
| MD5 |
e979a203d673adbc10fc19f643d3ac0a
|
|
| BLAKE2b-256 |
1330623dc6f3512ea306704aa75a37fbdcfc9c2d570ca20c08a9e43069d8a780
|