Skip to main content
v1.4.0 · Open source CLI · MIT license

A gron-style CLI to search and flatten nested JSON.

Gronify is a gron-style CLI that prints every JSON value on its own line with its full path, searches those lines by plain text or regex, and turns them back into JSON. It streams, so a multi-gigabyte file never has to fit in memory.

npm install -g gronify
npm install -g gronifygronify search payload.json --regex "status|version"json.service.status = "degraded"json.deployments[0].version = "2026.05.22"json.deployments[1].version = "2026.05.21"
How it works

Make JSON greppable, search it, and convert it back.

grep cannot tell you where a match sits inside nested JSON, and a jq filter is easiest to write once you know the path. Gronify prints each value with its full path, so a text search finds the key, the value, and its position in the document.

Flatten nested JSON into greppable lines

gronify flatten prints each value on its own line as path = value, in document order. Pipe the lines to grep, head, or any other text tool. Read the guide to flattening JSON.

gronify flatten service.jsonjson = {}json.service = {}json.service.name = "checkout"json.service.status = "degraded"json.deployments = []json.deployments[0] = {}json.deployments[0].region = "us-central1"

Search JSON keys and values with text or regex

gronify search flattens and filters in one pass, so you do not need grep. A plain term matches keys and values without regard to case. Add --regex for patterns, -c for exact case, -v to invert, or --count for a total. Read the guide to grepping JSON.

gronify search data.json --regex "users\[[0-9]+\]\.email"json.users[0].email = "ada@example.com"json.users[1].email = "grace@example.com"

Unflatten gron lines back into JSON (ungron)

gronify unflatten rebuilds JSON from full or grep-filtered gron lines, filling in missing parent containers automatically, and streams as it goes. Numbers come out with the digits they went in with, 64-bit IDs and trailing zeros included. Read the ungron guide.

gronify flatten checkout.json | gronify unflatten{"service":{"name":"checkout"}}

Search large JSON files without loading them

All three commands read a file or stdin in chunks and write output as they go, so the file does not have to fit in memory. Pass --stream for JSON Lines (NDJSON) logs. With -m or --limit, Gronify stops reading at the cap, prints a notice to stderr (the last line here), and exits 0. Read the guide to searching large JSON files or see fixing ERR_STRING_TOO_LONG in Node.js.

gzip -dc events.json.gz | gronify search -m 2 "error"json[0].error = "timeout"json[7].error = "connection reset"Stopped after 2 matches (--max-count); there may be more
Comparison

Gronify vs jq, gron, fastgron, and plain grep.

Use jq when you know the path and want to transform data. Use Gronify to find the path, keep numbers exact, search a file too large to load, or line up two files for diff. Measured time and memory for the same tools are in the benchmarks below.

vs. jq & JSON.parse()

Find a key's path without writing a jq filter

jq is the better tool once you know the path and want to reshape data. Gronify needs no query. Search for a key or a value and it prints the full path. It also prints numbers as written. In the edge-case round trip, Gronify kept -0.0, 1E+2, 1e-7, 1.0 as written; jq 1.8.2 normalised those spellings. JSON.parse() rounds integers above 2^53, and jq can too, depending on version and filter. Node cannot hand JSON.parse() a string over about 512 MB (ERR_STRING_TOO_LONG); Gronify reads the bytes in chunks. Read the jq alternative guide or see how jq rounds large numbers.

gronify search ledger.json --regex "id|amount"json.entries[0].id = 12345678901234567890json.entries[0].amount = 1.10

vs. gron & fastgron

A gron alternative with built-in search and streaming ungron

Gronify installs with npm on macOS, Linux, and Windows and searches by text or regex. gron leaves filtering to grep, and fastgron filters by fixed string (-F). Gronify keeps document order unless you pass --sort and streams in both directions: unflatten recorded 5.10 s at 97 MiB peak RSS on 2.24 GiB of gron (Apple M5 Pro, Node.js v22.23.1; measured 2026-11-05, from the benchmark below). gron and fastgron are native binaries that need no Node.js, and fastgron flattens faster when the file fits in memory. Read the gron, fastgron, and Gronify comparison.

gronify -o restored.json unflatten archive.gronOutput written to restored.json

vs. raw grep on JSON

Grep minified JSON and still see the full path

grep on minified JSON prints the whole file, because it is one line. On pretty-printed JSON it prints the matching key or value with no parent keys or array indexes. Gronify prints the full path on every line and has no nesting limit. Gronify flattens the 50,000-level fixture with piped output in 0.52 s at 85 MiB RSS (Apple M5 Pro, Node.js v22.23.1; measured 2026-11-05). Read the guide to finding a JSON path.

gronify search cluster-state.min.json "unhealthy"json.clusters[2].nodes[14].status = "unhealthy"

With system diff

Compare two JSON files with --sort and system diff

Flatten both files with --sort and hand the output to diff. --sort orders object keys at every level by UTF-16 code unit, keeps each object's lines together, and leaves arrays in index order. Reordered keys then produce no output, and a real change shows up with its full path. Piping through plain sort would put [10] before [2] and split objects apart. Read the guide to comparing two JSON files.

diff <(gronify --no-color flatten --sort old.json) <(gronify --no-color flatten --sort new.json)4c4< json.service.version = "2026.05.21"---> json.service.version = "2026.05.22"
Benchmarks

Time, memory, and the work each tool does.

On the 1001 MiB records flatten fixture, Gronify recorded 3.63 s at 65 MiB peak RSS. Compare tools within each chart. For tool selection, see the ecosystem comparison.

Flatten

1001 MiB JSON; median of 3 runs

  • Gronify
    Time3.63 s
    Peak memory65 MiB
  • gron
    Exceeded memory limit
  • gron --no-sort
    Exceeded memory limit
  • fastgron
    Time1.78 s
    Peak memory1.85 GiB
  • jq --stream (parser events)
    Time55.7 s
    Peak memory3 MiB
  • jaq
    Skipped (time budget)12.6 s on records 100 MB projects to ~125.4 s here, over 2x the 60 s timeout

Search (count matches)

1001 MiB JSON, case-sensitive match; median of 3 runs

  • Gronify
    Time4.27 s
    Peak memory55 MiB
  • gron
    Not rungron already failed on this input in flatten (it parses the whole document first)
  • gron --no-sort
    Not rungron --no-sort already failed on this input in flatten (it parses the whole document first)
  • fastgron
    Time8.50 s
    Peak memory1.85 GiB
  • fastgron -F
    Time2.19 s
    Peak memory1.85 GiB
  • jq --stream (parser events)
    Time59.0 s
    Peak memory3 MiB
  • jaq
    Skipped (time budget)14.5 s on records 100 MB projects to ~144.2 s here, over 2x the 60 s timeout

Unflatten

2.24 GiB gron statements from the same JSON; median of 3 runs

  • Gronify
    Time5.10 s
    Peak memory97 MiB
  • gron
    Not runfailed on the smaller records 10 MB input
  • fastgron
    Time6.10 s
    Peak memory7.46 GiB
  • jq --stream (parser events)
    Not applicablejq reads JSON, not gron statements
  • jaq
    Not applicablejaq reads JSON, not gron statements

Stop after 10 matches

1001 MiB records fixture, matches near the start; median of 3 runs

  • Gronify
    Time33 ms
    Peak memory52 MiB
  • gron
    Not rungron already failed on this input in flatten (it parses the whole document first)
  • gron --no-sort
    Not rungron --no-sort already failed on this input in flatten (it parses the whole document first)
  • fastgron
    Time0.39 s
    Peak memory1.85 GiB
  • fastgron -F
    Time1.36 s
    Peak memory1.85 GiB
  • jq --stream (parser events)
    Time23 ms
    Peak memory3 MiB
  • jaq
    Not runjaq already failed on this input in capped-flatten (it parses the whole document first)

Each metric uses its own linear scale within a chart. Lower is better. Full flatten and unflatten output goes to /dev/null; search counts matches and capped workloads stop early. Piped-output results are in BENCHMARKS.md. Time and RSS are independently aggregated; memory is the median of per-run peaks, and pipeline RSS is the largest individual process peak rather than the sum. Memory uses MiB and GiB. Peak memory for a run that timed out is the largest value seen while sampling the process tree. A tie means the two times are within 5% of each other.

What Gronify delivers

  • Memory across the measured sizes

    Completed Gronify flatten, search, and unflatten workloads used 52 MiB to 97 MiB peak RSS across 1 MiB to 1001 MiB records fixtures. On the 1001 MiB flatten fixture, Gronify used 3.4% of fastgron's peak RSS; elapsed times are shown above. Memory depends on document shape, depth, token size, flags, and output handling; this is not a fixed memory guarantee.

  • Read only as far as the cap

    On the 1001 MiB fixture, search -m 10 recorded 33 ms at 52 MiB peak RSS. A cap stops reading once enough matches are found. A late or absent match still requires scanning more input.

  • Reconstruct JSON in document order

    Gronify unflatten recorded 5.10 s at 97 MiB peak RSS for 2.24 GiB of gron statements. Out-of-order input and sorting use different buffering paths.

Tradeoffs and comparison limits

  • Compare the alternatives

    On the same 1001 MiB flatten workload, fastgron recorded 1.78 s at 1.85 GiB peak RSS; gron recorded exceeded memory limit; gron --no-sort recorded exceeded memory limit. Their ordering and formatting contracts differ.

  • jq produces a different output

    jq --stream recorded 55.7 s at 3 MiB peak RSS. It emits parser events rather than gron assignments. These timings compare end-to-end workflows, not identical output bytes or interchangeable features.

  • Startup and shared-host variation

    Process startup is included. Small-input results can be dominated by runtime startup, and shared-host load can move close timings. A 5% tie band is a display rule, not a statistical significance test.

Correctness and capability

Correctness and capability checks for each tool
CheckGronifygronfastgronjq --stream (parser events)jaq
big integers and trailing-zero decimals survive flatten (12345678901234567890, 98765432109876543210, 1.10)PassedPassedPassedPassedPassed
big integers and trailing-zero decimals survive a flatten and unflatten round tripPassedPassedPassedPassedNot applicableUnsupported by this workflow
round trip equals the input (3.2 MB of generated records)PassedPassedPassedPassedNot applicableUnsupported by this workflow
round trip equals the input (edge cases: empty containers, unicode, escapes, dotted/quoted/empty keys, -0, -0.0, exponents)PassedPassedPassedPassedNot applicableUnsupported by this workflow
unflatten of fastgron output equals the input (the gron statements used by the unflatten workloads)PassedPassedPassedNot applicableNot applicable
search count matches the `gron | grep -c timeout` reference (84)PassedPassedPassedPassedPassed
capped flatten returns exactly 10 lines that match the start of the full outputPassedPassedPassedPassedPassed
capped search returns exactly 10 lines that match the start of the full resultPassedPassedPassedPassedPassed
50,000 levels deep, output pipedTiming includes writing the expanded paths to a consumer.0.52 s85 MiB peak RSSNot runFailedTimed outNot run

These checks use small fixtures before timing. Passing them establishes only the tested cases. A skipped or unsupported check is not a failure. Full commands, raw samples, and failures are retained with the benchmark data.

Machine and versions

Measured 2026-11-05 on Apple M5 Pro, 48 GB RAM, macOS 26.6.1 (Darwin 25.6.0, arm64), Node.js v22.23.1. The host was shared; these are workload-specific observations.

Source: 4c78c13e5ba2. Runtime files and built artifacts are hashed in the raw results.

gronify 1.3.1 · gron 0.7.1 · fastgron 0.7.7 · jq 1.8.2 · jaq 3.1.2

Times are wall clock with process start-up included. Gronify was built from the source commit above. Reported times use the median of the recorded trials. Runs still going after 60 s were killed. Read the methodology and every result · Raw trials and provenance

Reproduce it

The script generates its own inputs, runs each tool, and rewrites BENCHMARKS.md and the data behind this page. Run it from src/packages/cli. The raw provenance records the source commit, harness hash, and exact flags for this sweep. Any comparison tool you have not installed is recorded as skipped.

cd gronify/src/packages/clinpm ci && npm run buildnpm run bench:compare -- --runs 3 --timeout 60 --max-rss-gb 8 --budget 45
AI agents and scripts

Use Gronify with AI coding agents on large JSON files.

An agent that reads a large JSON file whole fills its context with data it does not need. With Gronify it can count the matches, read a capped sample, and branch on the exit code. Shell scripts use the same flags. Read the guide for AI coding agents.

Count matches first, then read only a few lines

Run search --count to learn how many lines match before printing any. Then take a sample with -m, or look at the shape of the file with flatten --limit. Add --no-color so the output is plain text wherever it runs. Gronify stops reading the input at the cap, so when matches come early the file size hardly matters. In our benchmark, search -m 10 on the 1001 MiB fixture recorded 33 ms at 52 MiB peak RSS (Apple M5 Pro, Node.js v22.23.1; measured 2026-11-05).

gronify --no-color search export.json error --count482gronify --no-color search export.json error -m 3json.events[0].error = "upstream timeout"json.events[14].error = "rate limit exceeded"json.events[29].error = "connection reset"Stopped after 3 matches (--max-count); there may be more

Use exit codes in scripts and install the agent skills

With --exit-status, search exits 0 on a match, 1 on no match, and 2 on an error, as grep does. -o writes to a temp file and replaces the target only after the run succeeds. The Gronify agent skills on skills.sh teach supported coding agents the count-then-cap routine, large JSON exploration, JSONL log search, key-sorted comparison with diff, OpenAPI and lockfile audits, and path-to-jq workflows.

npx skills add 1solomonwakhungu/gronifyif gronify --no-color search --exit-status config.json -m 1 "debug = true" >/dev/null 2>&1; then echo "debug is on"; fidebug is on

gronify-json-flatten-search

Core CLI workflow for flattening, searching, shell branching with --exit-status, and unflattening.

npx skills add 1solomonwakhungu/gronify --skill gronify-json-flatten-search

large-json-search

Size gate, 5-step narrowing loop, and gzipped pipes for files over 50 KB or multi-GB exports.

npx skills add 1solomonwakhungu/gronify --skill large-json-search

jsonl-ndjson-log-search

Stream-search .jsonl and .ndjson logs, pull records by index, and convert to a JSON array (Gronify 1.4.0+).

npx skills add 1solomonwakhungu/gronify --skill jsonl-ndjson-log-search

json-compare-sorted-diff

Key-sorted path comparison using flatten --sort with system diff, PowerShell, or git textconv.

npx skills add 1solomonwakhungu/gronify --skill json-compare-sorted-diff

openapi-lockfile-json-search

Path-anchored regex recipes for OpenAPI specs, package-lock.json, kubectl JSON, and AWS exports.

npx skills add 1solomonwakhungu/gronify --skill openapi-lockfile-json-search

json-path-to-jq-and-unflatten

Turn printed paths into jq filters or JSONPath, keep 64-bit numbers exact, and unflatten subsets (parent synthesis in 1.4.0+).

npx skills add 1solomonwakhungu/gronify --skill json-path-to-jq-and-unflatten
Use cases

Debug API responses, CI artifacts, and config in the shell.

Gronify reads a file or stdin and writes to stdout, so it fits anywhere a pipe does. When the JSON is broken, the error gives the byte offset, line, and column. For worked recipes on real specs and manifests, read the guide to searching OpenAPI specs, package-lock.json, and Kubernetes JSON.

Incident response

Pipe a service response into gronify search and see every status, version, or error field with its full path, without opening an editor.

Failed CI builds

Check a generated manifest or build artifact from a script. search --exit-status fails the step when the value you need is missing.

Support bundles

Search a multi-gigabyte customer export on your own machine. Gronify makes no network requests, so the data stays where it is.

Config changes

Flatten the old and new file with --sort, then run diff. Reordered keys drop out and each change shows its path.

Commands

Gronify commands: flatten, search, and unflatten.

Each command reads a file or stdin and writes to stdout, or to a file with -o. Global options set color, indentation, and the output file. Command flags cap, sort, and filter the output.

gronify flatten [file]

Print JSON or JSON Lines (--stream) from a file or stdin as one path = value line per value. Numbers keep the digits they have in the source.

gronify flatten data.jsongronify flatten --stream events.jsonlgronify flatten --sort --limit 100 data.json

gronify search <file_or_term> [term]

Flatten and filter JSON or JSON Lines (--stream) in one pass. Match plain text or a regex, cap the results, or print only the count.

gronify search data.json "service"gronify search --stream events.jsonl "timeout"gronify search --exit-status data.json -m 1 "debug = true"

gronify unflatten [file]

Turn full or filtered gron lines from a file or stdin back into JSON. Missing parent containers are filled in automatically.

gronify unflatten data.grongronify flatten data.json | gronify unflattengronify search data.json "status" | gronify unflatten

Global options

--color Enable color when the terminal supports it

--no-color Force plain output for pipes and logs

--pretty Indent and group formatted flatten or unflatten output

-o, --output <file> Write to a file, replaced only after the run succeeds

-h, --help Show help for any command

-V, --version Show the CLI version

Flatten options

--limit <n> Stop after n lines and stop reading the input

--sort Sort object keys at every level by UTF-16 code unit; arrays keep their order

-s, --stream, --jsonl Read JSON Lines / NDJSON (one JSON value per line)

Search options

-r, --regex Treat the term as a JavaScript regular expression

-c, --case-sensitive Respect exact letter case

--count Print only the number of matches

-v, --invert-match Show lines that do not match

-m, --max-count <n> Stop after n matches and stop reading the input

--sort Sort matching lines by object key, as flatten --sort does

--exit-status Exit 1 when nothing matches; errors then exit 2

-s, --stream, --jsonl Read JSON Lines / NDJSON (one JSON value per line)

Install

Install Gronify with npm or Homebrew, or build from source.

Install with npm on macOS, Linux, or Windows, or use Homebrew, a GitHub release archive, or a source build. Gronify needs Node.js 20 or newer. Result caps, --sort, and --exit-status need v1.2.0 or later; JSON Lines (--stream) and filtered unflatten need v1.4.0 or later. On Windows, read the PowerShell and cmd guide.

npm

npm or npx

npm install -g gronifynpx gronify --help

brew

Homebrew

brew install 1solomonwakhungu/tap/gronify

source

Build from source

git clone https://github.com/1solomonwakhungu/gronify.gitcd gronify/src/packages/clinpm ci && npm run build && npm link

verify

Verify the CLI

gronify --versiongronify flatten data.json

Requirements

Node.js — 20 or newer

npm (from source) — 10 or newer

External tools — None required

License — MIT

Current release — v1.4.0

Frequently asked questions

What is Gronify?

Gronify is an open source command-line tool that flattens JSON into one line per value, each with its full path, so you can search nested data with plain text or a regex. It is modeled on gron, has search and unflatten built in, and streams its input, so multi-gigabyte files work.

How do I grep or search a JSON file from the command line?

Run gronify search file.json term. Gronify flattens the file and prints each matching line as path = value, so you see where the match sits. A plain term is a case-insensitive substring match on the whole line. Add --regex for a JavaScript regular expression, -c for exact case, or --count for a total. From a pipe, pass only the term: curl -s URL | gronify search status.

Is Gronify a drop-in replacement for gron?

No. Gronify uses the same path = value lines, but the commands and the output differ. The commands are gronify flatten and gronify unflatten, where gron uses gron and gron --ungron. Lines have no trailing semicolon. Keys stay in document order unless you pass --sort, while gron sorts by default. --sort compares keys by UTF-16 code unit; gron puts bare keys before bracketed ones and compares UTF-8 bytes. Gronify unflatten reads gron's output and fills in parents missing from grep-filtered lines, just as gron --ungron does. gron --ungron does not read Gronify's output, which lacks the semicolons.

Is Gronify an alternative to jq?

For finding data, yes. For transforming it, no. jq can report paths too, but you have to write a filter for it. Gronify shows you the path when all you have is a key name or a value. It also streams large files without extra flags. Gronify has no query language, so keep jq for reshaping, arithmetic, and building new JSON.

Does Gronify work on Windows, macOS, and Linux?

Yes. Gronify is a Node.js program, so npm install -g gronify works on all three with Node.js 20 or newer. Search is built in, so PowerShell and cmd users do not need grep. Homebrew, a GitHub release archive, and a source build are also available. CI runs the test suite on Linux, macOS, and Windows.

How large a JSON file can Gronify handle?

Gronify has no built-in size limit, because flatten, search, and unflatten read their input in chunks and write output as they go. In the benchmark, unflatten recorded 5.10 s at 97 MiB peak RSS on 2.24 GiB of gron (Apple M5 Pro, Node.js v22.23.1; measured 2026-11-05). Memory depends on the document and the flags. One string or number must fit in memory. --sort holds each object's lines and spills to a temp file past 64 MiB. Unflatten input that is out of document order is rebuilt in memory only when the problem shows up in the first 16 MiB; after that it fails. Colored unflatten output builds the whole document, so pass --no-color for very large input.

Does Gronify round large numbers the way JSON.parse does?

No. Gronify checks that each number is valid JSON and prints it exactly as written, so 12345678901234567890, 1.10, -0, and 1e-7 come through flatten, search, and unflatten unchanged. JSON.parse rounds integers above 2^53 (9007199254740992) to the nearest double. jq 1.7 and later keeps a number as written when it passes through untouched, but rounds it once a filter does arithmetic on it.

How do I compare two JSON files from the command line?

Flatten both files with --sort and give the output to your system's diff. In bash or zsh: diff <(gronify --no-color flatten --sort old.json) <(gronify --no-color flatten --sort new.json). --sort puts object keys in the same order on both sides and leaves arrays in index order, so reordered keys produce no output. Gronify has no diff command of its own. In PowerShell or cmd, write each side to a file with -o and compare the files.

How do AI coding agents use Gronify on large JSON files?

They count first, then read a capped sample. gronify --no-color search file.json term --count prints how many lines match. search -m 20 prints the first 20 matches and stops reading the file, and flatten --limit 50 shows the shape of the document. A large file never enters the model's context whole. The Gronify agent skills on skills.sh (gronify-json-flatten-search, large-json-search, and four task-focused skills) teach supported agents this routine.

Does Gronify send my JSON data anywhere?

No. Gronify reads files and stdin on your machine and writes to stdout or a local file. It makes no network requests and has no telemetry.

What does Gronify do with invalid JSON?

It stops with exit code 1 (2 with search --exit-status) and an error that names the byte offset, line, and column, such as: Unexpected '}' after ',' (trailing commas are not allowed) at byte offset 7 (line 1, column 8). Gronify accepts strict JSON only, so trailing commas, comments, single quotes, and invalid UTF-8 are errors. By default each run expects one JSON document; pass -s, --stream, or --jsonl to read JSON Lines (NDJSON). Lines before the error may already be printed, so check the exit code in scripts.

How fast is Gronify compared with gron and fastgron?

On the 1001 MiB records flatten fixture, Gronify recorded 3.63 s at 65 MiB peak RSS. Completed Gronify flatten, search, and unflatten workloads used 52 MiB to 97 MiB peak RSS across 1 MiB to 1001 MiB records fixtures. On the 1001 MiB flatten fixture, Gronify used 3.4% of fastgron's peak RSS; elapsed times are shown above. Memory depends on document shape, depth, token size, flags, and output handling; this is not a fixed memory guarantee. On the 1001 MiB fixture, search -m 10 recorded 33 ms at 52 MiB peak RSS. A cap stops reading once enough matches are found. A late or absent match still requires scanning more input. Gronify unflatten recorded 5.10 s at 97 MiB peak RSS for 2.24 GiB of gron statements. Out-of-order input and sorting use different buffering paths. On the same 1001 MiB flatten workload, fastgron recorded 1.78 s at 1.85 GiB peak RSS; gron recorded exceeded memory limit; gron --no-sort recorded exceeded memory limit. Their ordering and formatting contracts differ. Measured 2026-11-05 on Apple M5 Pro, 48 GB RAM at source commit 4c78c13e5ba2. Methodology and raw results: https://github.com/1solomonwakhungu/gronify/blob/main/src/packages/cli/BENCHMARKS.md

Try Gronify on the next JSON file you have to search.

Gronify is open source under the MIT license. Read the code, report an issue, or build the CLI from source.

View the repositoryReport an issue