df.describe() for JSON and nested data - a human-readable shape summary in one call.
Project description
JSON Glance
See the shape of any JSON or nested data at a glance.
You get a JSON blob - an API response, a webhook payload, a .jsonl export - and
your first question is always "what does this thing even look like?" JSON Glance
answers it in one call: it walks the data and prints a compact summary of its
shape - types, nesting, sizes, value ranges, and null rates - so you stop
scrolling through raw JSON to find out.
Think df.describe(), but for nested data instead of tables. Zero dependencies,
pure standard library, Python 3.9+.
What it shows
- Merged shapes - every dict in an array is folded into a single schema, so a long list of records prints as one shape instead of one block per element.
- Honest denominators - a key absent from a record and a key present with a null value are reported as two distinct facts, never conflated.
- Type unions - when a field holds more than one type, every type observed is listed with the share of values that took it.
- Value stats - numeric ranges, string-length ranges, boolean true-rates, and collection sizes.
- Pattern hints - common string formats such as UUIDs, emails, and timestamps are flagged, but only when every value at that position matches.
- Map detection - a dict used as a key-value store is summarized as a map rather than dumped as a giant record.
- Safe on anything - it never recurses into an object's internals or calls your code; non-JSON values are reported by type name, and cyclic structures are detected instead of causing a hang.
Install
pip install json-glance
Usage
Python
from json_glance import glance, summary
glance(data) # print the shape summary to stdout
text = summary(data) # ...or capture it as a string (logs, tests, notebooks)
glance(data, depth=3) # limit how many levels deep it descends
Command line
json-glance response.json # summarize a JSON file
json-glance events.jsonl # newline-delimited JSON, all records merged
curl -s https://api.example.com/x | json-glance # or straight from a pipe
Example
Run it on a typical paginated API response (examples/api_response.json - three
users, with pagination metadata):
$ json-glance examples/api_response.json
dict · 5 keys
├─ users list · 3 items
│ └─ dict · 9 keys
│ ├─ id str len 36 ~uuid
│ ├─ email str len 15 – 17 ~email
│ ├─ name str len 12 – 14
│ ├─ role str len 4 – 5
│ ├─ verified bool 67% true
│ ├─ created_at str len 20 ~datetime
│ ├─ login_count int 5 – 342
│ ├─ profile dict · 2 keys
│ │ ├─ city str len 6 – 8
│ │ └─ timezone str len 13 – 19
│ └─ deactivated_at null (67% missing)
├─ page int = 1
├─ per_page int = 20
├─ total int = 3
└─ next_cursor null
The three user records were merged into one shape. At a glance: id always
looks like a UUID and email always like an email, created_at is always a
timestamp, verified is true for two of three users, login_count ranges
5-342, and deactivated_at is set on only one user (so 67% missing). A
1,000-user response would print the exact same shape - just with bigger numbers.
API
| Function | Returns | Description |
|---|---|---|
glance(data, *, depth=6, max_keys=50, file=None) |
None |
prints the summary |
summary(data, *, depth=6, max_keys=50) |
str |
returns the summary as a string |
depth- nesting levels to show before collapsing to….max_keys- record keys to show before+N more.
License
MIT.
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 json_glance-0.1.1.tar.gz.
File metadata
- Download URL: json_glance-0.1.1.tar.gz
- Upload date:
- Size: 15.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bae18b513b5071dfbca5a68c7575179ebc1bfd2c38885de500a6f47ae9f5cfe2
|
|
| MD5 |
63055b0ab74b41511da5f4e57530d15f
|
|
| BLAKE2b-256 |
38317a1efcca15fb676fe89d9a50e47c49f62e6d4263801a5fcafed1d5f8173f
|
File details
Details for the file json_glance-0.1.1-py3-none-any.whl.
File metadata
- Download URL: json_glance-0.1.1-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52854e7039a3a1f0a0600b5e42cd21464cc56a08f2396dccacda57f0b3e41d68
|
|
| MD5 |
e78d995c4d0aa381f0e4110bfea35fc2
|
|
| BLAKE2b-256 |
cc68d24532a05984d47ea7adae4c0dd59e55cda2d4fe63e636cc01d712d41957
|