Skip to main content

A JSON to CSV converter for analysts who chronically can't parse JSON themselves. Dedicated to Konstantinos Chronis.

Project description

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

pip install chronically-needs-csv

Or if you're Konstantinos and 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": "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):

[
  {
    "name": "Konstantinos",
    "tools": {"primary": "BigQuery", "avoided": "Python"},
    "skills": ["SQL", "asking friends for help"]
  }
]

Output (analysts.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:

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chronically_needs_csv-0.0.1.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chronically_needs_csv-0.0.1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file chronically_needs_csv-0.0.1.tar.gz.

File metadata

  • Download URL: chronically_needs_csv-0.0.1.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

Hashes for chronically_needs_csv-0.0.1.tar.gz
Algorithm Hash digest
SHA256 25767dc97e61b20d8b6fe5a855495510923f84635e29b0f5494a507f26c2b7ef
MD5 88e95a735722acfb6ba7d87f38bcd381
BLAKE2b-256 e244a8509ae6bc19b0f09b76ce38090433c20c2079ecd3b3932c9177a4a31809

See more details on using hashes here.

File details

Details for the file chronically_needs_csv-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for chronically_needs_csv-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3ea8211755be97700db5eba36821b17c60158612b61434c1171b070bc30be1cb
MD5 cfcbec843648c3f42f75bedd12af946f
BLAKE2b-256 46d1a2f6a66fcfbe9beb2fc5501d5cac61edf42221bbb6caf7cec544a871ae59

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page