explaingit

tomnomnom/gron

14,433GoAudience · developerComplexity · 1/5Setup · easy

TLDR

Gron is a command-line tool that flattens JSON into one line per value with full key paths so you can search nested API responses with grep, then reconstruct valid JSON from the filtered lines with --ungron.

Mindmap

mindmap
  root((gron))
    What it does
      Flatten JSON
      One line per value
      Full key paths
    Key Features
      grep compatible
      ungron rebuild
      File URL pipe
    Install
      Single binary
      Homebrew Mac
      Linux Windows
    Audience
      CLI users
      API debuggers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Search a complex nested JSON API response for a specific field by piping it through gron and using grep.

USE CASE 2

Extract specific nested values from a JSON payload and reconstruct a smaller valid JSON object using gron --ungron.

USE CASE 3

Explore an unfamiliar API response structure by seeing every value and its full key path on a separate line.

Tech stack

Go

Getting it running

Difficulty · easy Time to first run · 5min

In plain English

Gron is a small command-line tool that reformats JSON data into a flat list of simple statements, where each line shows the full path to a single value. JSON is a common format that web services use to return data, but deeply nested JSON can be hard to search through by hand. Gron solves that by flattening the structure so that standard search tools like grep can work on it naturally. For example, if you fetch data from a web API and pipe it through gron, instead of seeing a complex nested structure, you get one line per value such as: json.user.name = "Alice", or json.results[0].score = 42. You can then search for any keyword and immediately see not just the value but the full path of keys and indexes needed to reach it. Gron also works in reverse. If you filter the flattened output down to only the lines you care about and then run it again with the --ungron flag, it reconstructs valid JSON from just those lines. This makes it practical to extract specific pieces of a large JSON response without writing any code or learning a query language. The tool accepts input from a file, a URL, or piped data from another program. It has no runtime dependencies, so installation is just downloading a single binary for your operating system (Linux, Mac, Windows, or FreeBSD) and putting it somewhere on your path. Mac users can also install it through the Homebrew package manager. Gron is written in Go and is intentionally simple in scope. Its README notes that more powerful JSON query tools exist, but gron's goal is to let you use search and text tools you already know rather than learning a new query syntax. It is open source and has no license file listed in the README, though it has been widely adopted in developer workflows.

Copy-paste prompts

Prompt 1
Show me how to pipe a curl API response through gron and grep to find all fields containing the word 'error' with their full key paths.
Prompt 2
How do I use gron and --ungron to extract just the name and email fields from a large nested JSON API response and get back valid JSON?
Prompt 3
What is the gron command to read a JSON file from disk and search for all array elements where the score value is greater than 100?
Prompt 4
How do I install gron on Mac with Homebrew and use it to explore a GitHub API response to find a repository's default branch name?
Open on GitHub → Explain another repo

← tomnomnom on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.