Skip to main content

JSON Enhanced - Convert and analyze JSON data as interactive tables

Project description

jsone - JSON Enhanced for Python

Convert and analyze JSON data as interactive tables in Python.

Installation

pip install jsone

Quick Start

import json
from jsone import table_from_json

# Load JSON data
users = [
    {"name": "Alice", "age": 30, "city": "NYC"},
    {"name": "Bob", "age": 25, "city": "LA"},
    {"name": "Charlie", "age": 35, "city": "Chicago"},
]

# Convert to table
result = table_from_json(users)

# Access data
print(result.rows)       # List of dicts
print(result.columns)    # Column names

# Export formats
print(result.to_csv())   # CSV string
print(result.to_json())  # JSON string

API

table_from_json(data)

Convert JSON data to a table.

Parameters:

  • data (dict, list, or JSON-serializable): The data to convert

Returns:

  • TableResult object with .rows and .columns

Example:

from jsone import table_from_json

data = [
    {"id": 1, "name": "Alice"},
    {"id": 2, "name": "Bob"},
]

result = table_from_json(data)
# result.rows = [{"id": 1, "name": "Alice"}, {"id": 2, "name": "Bob"}]
# result.columns = ["id", "name"]

TableResult Methods

  • .to_csv() - Export as CSV string
  • .to_json() - Export as JSON string
  • .to_list() - Get rows as list of dicts

Example:

result.to_csv()   # "id,name\n1,Alice\n2,Bob"
result.to_json()  # '[{"id": 1, "name": "Alice"}, ...]'
result.to_list()  # [{"id": 1, "name": "Alice"}, ...]

File Operations

from jsone import load_json_file, save_csv_file, save_json_file

# Load from file
data = load_json_file("data.json")
result = table_from_json(data)

# Save as CSV
save_csv_file("output.csv", result)

# Save as JSON
save_json_file("output.json", result)

Features

  • ✅ Convert JSON arrays to table format
  • ✅ Auto-detect table structure
  • ✅ Export to CSV, JSON, or Python dicts
  • ✅ Simple, zero-dependency API
  • ✅ Pure Python implementation
  • ✅ Compatible with pandas (convert to DataFrame)

Pandas Integration

import pandas as pd
from jsone import table_from_json

data = [{"x": 1, "y": 2}, {"x": 3, "y": 4}]
result = table_from_json(data)
df = pd.DataFrame(result.rows)

Comparison with JSON

Standard JSON Approach

import json
data = json.load(open("users.json"))
# Manually iterate and analyze
for user in data:
    print(user["name"], user["age"])

jsone Approach

from jsone import table_from_json, load_json_file
result = table_from_json(load_json_file("users.json"))
# Instant tabular view with analysis
print(result.to_csv())  # Or .to_json() or .rows

License

MIT

See Also

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

mohanreddy_jsone-0.4.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

mohanreddy_jsone-0.4.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file mohanreddy_jsone-0.4.0.tar.gz.

File metadata

  • Download URL: mohanreddy_jsone-0.4.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for mohanreddy_jsone-0.4.0.tar.gz
Algorithm Hash digest
SHA256 8ea8ddda18efe22aea944c16097c33d4abf183f7ac0c24a056caa4c6a688c8dc
MD5 beac3b2149165e6fae70997cec1f2f35
BLAKE2b-256 07a71962ef05896166f3df1c838f79b0bf63880a2d1950d9bdfe8df6165c79d6

See more details on using hashes here.

File details

Details for the file mohanreddy_jsone-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mohanreddy_jsone-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cdcbac131e3c32c55a7c9a44738d4da7d8367aeefc489f76bf1822387ba4013e
MD5 1c14ff4cf24fff1f278298721e099cf4
BLAKE2b-256 c4389066b46a4444963f624ba13eb67d8f588abb12678719afcfd6e4c0e49d05

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