Glom reads, restructures, and validates nested Python data with path specs and a matching command-line tool.
Overview
Glom targets nested dicts, lists, and objects common in APIs and application data. The core function takes a target structure and a specification that describes which paths to read or how to reshape values.
Specifications are declarative and Pythonic. The library provides clear error messages when a path or transform fails, plus debugging aids for exploring structure. Beyond simple gets, it supports assignment, streaming iteration, grouping, validation, matching, and custom specifier types.
Installing the package also installs a glom command-line interface for trying specs interactively; the same specs translate directly into application code.
It is pure Python and runs on CPython and PyPy across several Python versions. Documentation includes a tutorial, API reference, FAQ, and a browser-based playground for experiments.
Key features
- Path-based nested access
- Declarative transformation specs
- Readable error messages
- Command-line interface
- Data validation and matching
- Streaming and assignment helpers
Use cases
- Parsing API responses
- ETL on nested JSON
- Config and payload reshaping
- Shell data probing