# gron

> Transforms JSON into discrete assignments to make it greppable and enable exploration of complex JSON structures

Stars: 14.5k · Language: Go · License: MIT · Categories: Data

- Repository: https://github.com/tomnomnom/gron
- Page: https://www.trmn.sh/tools/gron
- Demo video: https://media.trmn.sh/demos/2608edb2acc97326ebb0bdc70928cf4b499e7191bbd631be68101a5b811b0df6.mp4

## Install

- Homebrew: `brew install gron`
- Go: `go install github.com/tomnomnom/gron@latest`

## Overview

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.

### Installation

```bash
# via Homebrew
brew install gron
```

```bash
# via Go
go install github.com/tomnomnom/gron@latest
```

## Alternatives

- [yq](https://www.trmn.sh/tools/yq.md): Command-line YAML, JSON, XML, and CSV processor with jq-like syntax for querying and transforming structured data (Go, 16.2k stars)
- [usql](https://www.trmn.sh/tools/usql.md): Universal command-line SQL client with PostgreSQL psql-inspired interface for multiple databases (Go, 10.2k stars)
- [miller](https://www.trmn.sh/tools/miller.md): Command-line data processing tool for CSV, TSV, JSON, and JSON Lines with field-based operations (Go, 10.1k stars)
- [pup](https://www.trmn.sh/tools/pup.md): Command line HTML processing tool using CSS selectors to filter and extract data from HTML documents (Go, 8.4k stars)
- [fx](https://www.trmn.sh/tools/fx.md): Terminal-based JSON processor and viewer for querying, filtering, and manipulating JSON data interactively. (Go, 20.7k stars)

## Guides

- [Best JSON CLI Tools](https://www.trmn.sh/best/json-cli-tools): Compare jq, yq, gojq, fx, dasel, gron and qo for querying, filtering and transforming JSON (and YAML) from the command line.

---

Canonical: https://www.trmn.sh/tools/gron
