Transforms JSON into discrete assignments to make it greppable and enable exploration of complex JSON structures
gron is a JSON processing tool that flattens JSON data into discrete assignment statements, making it possible to use grep and other text-processing tools on JSON structures. It converts nested JSON objects and arrays into dot-notation paths that show the complete hierarchy to each value, which is particularly useful when exploring large API responses with unknown or poorly documented structures.
The tool works bidirectionally - it can transform JSON into greppable assignments and then reconstruct filtered results back into valid JSON using the --ungron flag. This enables workflows where you can grep for specific fields, modify the assignments, and convert back to JSON. For example, you can extract only certain properties from a complex JSON response or diff JSON files by comparing their gron output.
gron accepts input from files, URLs, or stdin, making it easy to integrate into existing pipelines with curl or other tools. The output is valid JavaScript that can be executed, and the tool supports both traditional assignment format and JSON stream format. It includes features like colorized output, streaming mode for line-delimited JSON, and options to control sorting and certificate validation for HTTPS requests.
# via Homebrew
brew install gron
# via Go
go install github.com/tomnomnom/gron@latest