Skip to main content

Simple, pandas-like JSON handler for structured and unstructured data

Project description

json_therule0

A Python library for cleaning messy JSON files. Built as a practical example of OOP principles.

What It Does

JSON from APIs and databases is often messy - full of whitespace, nulls, and duplicates. This library loads your JSON, cleans it, and gets it ready to analyze.

from json_therule0 import read_json

data = read_json('messy.json')
data.head()
data.stats()
data.to_csv('clean.csv')

Install

pip install json-therule0

Or from source:

git clone https://github.com/charlesnaces/OOP-FINAL-PROJECT
cd OOP-FINAL-PROJECT
pip install -e .

Quick Example

from json_therule0 import read_json

# Load and clean
data = read_json('data.json')

# Look at it
print(data.shape())        # (rows, cols)
print(data.columns())      # column names
print(data.head(5))        # first 5 rows
data.display_record(0)     # pretty print single record (any nesting level)

# Analyze
print(data.stats())        # statistics

# Filter and process
active = data.filter('status', 'active')
subset = data.select(['name', 'email'])
sorted_data = data.sort('age', ascending=True)

# Export
data.to_csv('output.csv')
data.to_json('output.json')

Key Features

Simple API - pandas-like interface
Auto-normalization - Handles unstructured JSON (COCO, nested dicts, etc.)
Smart cleaning - Removes whitespace, nulls, duplicates automatically
Rich filtering - Filter, select, sort with validation
Statistics - Get stats for any column (numeric or categorical)
Multiple exports - Save as CSV or JSON
Production-ready - 51 comprehensive tests, all passing

What's Inside

  • Processor: Load and clean JSON (removes whitespace, nulls, duplicates)
  • Analyzer: Inspect and export data (stats, filtering, CSV/JSON output)
  • Normalizer: Handle weird JSON formats (COCO, nested structures)
  • JSONFile: Simple wrapper that uses all three automatically

Testing

Run with:

pytest tests/ -v

Results:

  • ✅ 51 tests passing
  • ✅ 36 new JSONFile tests
  • ✅ All edge cases covered
  • ✅ Zero failures

Documentation

  • API Reference: docs/API_REFERENCE.md - Complete method documentation
  • Examples: examples/basic_usage.py - 10 working examples
  • Limitations: docs/LIMITATIONS.md - Known limitations and workarounds
  • Real-world Scenarios: examples/real_world_scenarios.py - Production data examples
  • Unstructured Data: examples/unstructured_api_data.py - Real API response handling

Recent Improvements (v0.2.0)

✅ Complete OOP implementation with 7 classes
✅ Auto type inference and conversion
✅ Unstructured JSON normalization (COCO, nested dicts, arrays)
✅ Real-world production examples (employees, transactions, APIs)
✅ 51 comprehensive tests (all passing)
✅ Complete documentation with limitations guide
✅ Zero external dependencies
✅ Pandas-like simple API

Why This Exists

Started as a school project to demonstrate OOP principles in real code. Features actual classes, encapsulation, composition, and single responsibility doing useful work - not just theory.

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

json_therule0-0.2.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

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

json_therule0-0.2.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file json_therule0-0.2.0.tar.gz.

File metadata

  • Download URL: json_therule0-0.2.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for json_therule0-0.2.0.tar.gz
Algorithm Hash digest
SHA256 14896a088b5dc0d66faf2f1ad1918ca9803b89bb44453cd9a46e45da2c565fd1
MD5 8f77f2474f10754c1daf003532086f70
BLAKE2b-256 9a3921a135e888f7ec64b62872b25fe9b33940cca50dcba69194bf4d00388427

See more details on using hashes here.

File details

Details for the file json_therule0-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: json_therule0-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for json_therule0-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4a1536a36f0e040f4e4fae97d707d9df1c549148a0ee5877d355d429f5099d4a
MD5 cc7a9537bd9b3fe86822f7303e2fc7a9
BLAKE2b-256 8b6ad286cb8b1cf53491d31ca06827e3c8d9b8b36b5946bebdbf039c431684e8

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