Transforms JSON into discrete assignments to make it greppable with standard Unix tools
gron is a command-line tool that converts JSON data into discrete assignment statements, making complex JSON structures searchable with standard Unix tools like grep. It transforms nested JSON objects and arrays into flat key-value assignments that show the complete path to each value, enabling users to quickly locate specific data within large JSON responses without needing to understand the entire structure beforehand.
The tool operates bidirectionally through its --ungron flag, allowing users to filter the flattened output and reconstruct it back into valid JSON. This workflow enables powerful JSON manipulation by combining gron with familiar text processing tools. For example, users can grep for specific fields, pipe the results through sed for modifications, then convert back to JSON format.
gron accepts input from files, URLs, or stdin, making it suitable for exploring API responses, processing JSON logs, or analyzing configuration files. It outputs valid JavaScript assignments by default, but also supports JSON stream format. The tool includes options for colorized output, stream processing of line-separated JSON objects, and certificate validation control for HTTPS requests.
Developers working with APIs, system administrators processing JSON logs, and anyone dealing with deeply nested JSON structures will find gron particularly useful for data exploration and extraction tasks where the JSON schema is unknown or poorly documented.
# via Homebrew
brew install gron
# via Go
go install github.com/tomnomnom/gron@latest