Skip to main content

JSON Glance

See the shape of any JSON or nested data at a glance.

PyPI Python License: MIT Dependencies

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.

Metadata

Release files for json-glance 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for json-glance 0.1.1
File Size Uploaded
json_glance-0.1.1.tar.gz 15.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for json-glance 0.1.1
File Interpreter ABI Platform
json_glance-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 29.1 kB

Release files / json_glance-0.1.1.tar.gz

Download URL json_glance-0.1.1.tar.gz
Size 15.5 kB
Tags Source
SHA-256 checksum
How to use checksums
bae18b513b5071dfbca5a68c7575179ebc1bfd2c38885de500a6f47ae9f5cfe2
BLAKE2b-256 checksum
How to use checksums
38317a1efcca15fb676fe89d9a50e47c49f62e6d4263801a5fcafed1d5f8173f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / json_glance-0.1.1-py3-none-any.whl

Download URL json_glance-0.1.1-py3-none-any.whl
Size 13.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
52854e7039a3a1f0a0600b5e42cd21464cc56a08f2396dccacda57f0b3e41d68
BLAKE2b-256 checksum
How to use checksums
cc68d24532a05984d47ea7adae4c0dd59e55cda2d4fe63e636cc01d712d41957
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page