Metadata-Version: 2.4
Name: chronically-needs-csv
Version: 0.0.1
Summary: A JSON to CSV converter for analysts who chronically can't parse JSON themselves. Dedicated to Konstantinos Chronis.
Project-URL: Repository, https://github.com/JellevanE/chronically-needs-csv
Project-URL: Issues, https://github.com/JellevanE/chronically-needs-csv/issues
Author: A tired friend
License-Expression: MIT
License-File: LICENSE
Keywords: analyst,chronis,converter,csv,json,konstantinos
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Text Processing :: General
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# chronically-needs-csv

> *For Konstantinos Chronis, 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

```bash
pip install chronically-needs-csv
```

Or if you're Konstantinos and somehow mess that up too:

```bash
pip install git+https://github.com/JellevanE/chronically-needs-csv.git
```

## Usage

### Command Line

```bash
# 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

```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": "Konstantinos", "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 Konstantinos's JSON knowledge)
- **Any JSON shape** → handled automatically

## Example

Input (`analysts.json`):
```json
[
  {
    "name": "Konstantinos",
    "tools": {"primary": "BigQuery", "avoided": "Python"},
    "skills": ["SQL", "asking friends for help"]
  }
]
```

Output (`analysts.csv`):
```csv
name,tools.primary,tools.avoided,skills
Konstantinos,BigQuery,Python,"SQL, asking friends for help"
```

## BigQuery Import

After converting, Konstantinos can finally do what he does best:

```sql
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.*
