Guides for working with JSON in the terminal
Each guide starts from one question, answers it, and shows the commands with their real output.
How to grep nested JSON from the command line
Plain grep prints a whole minified line or a key with no parent. Flatten JSON to one path per line and filter it with gronify search to locate each match.
Search nested JSON in PowerShell and cmd without grep
Select-String prints whole lines and ConvertFrom-Json needs a query per question. Search nested JSON on Windows by path with gronify search, no grep or WSL.
Flatten nested JSON to one line per value
Flatten nested JSON to one path = value line per value with gronify flatten. See how arrays, empty objects, and odd keys print, and how to reverse it.
Find the path to any key or value in a JSON file
Print the full path of any key or value in a JSON file with gronify search, turn that path into a jq filter, or list paths with jq alone using paths(scalars).
Unflatten gron lines back into JSON (ungron)
gronify unflatten turns json.path = value lines back into JSON. See the round trip, filtered search subsets, which gron output it reads, and sed edits.
Compare two JSON files with diff, ignoring key order
Flatten both JSON files with gronify flatten --sort so the keys line up, then run the system diff. Every changed line shows the full path to its value.
Search a multi-gigabyte JSON file from the command line
Node stops at ERR_STRING_TOO_LONG near 512 MB and jq parses the whole file first. Search a large JSON file as a stream with gronify search or jq --stream.
Fix RangeError: Invalid string length when reading large JSON in Node.js
Node.js throws ERR_STRING_TOO_LONG or RangeError: Invalid string length on JSON over 512 MB. Find the failing call, stream it in code, inspect it with gronify.
Search OpenAPI specs, package-lock.json, and Kubernetes JSON from the command line
Find endpoints, auth schemes, and deprecated operations in OpenAPI specs, package versions in package-lock.json, and fields in kubectl JSON with gronify search.
gron alternatives: gron, fastgron and Gronify compared
gron, fastgron and Gronify compared with dates: latest releases, install methods, output format, speed, memory on large files, npm and Windows support.
A jq alternative for exploring JSON you do not know yet
jq transforms JSON whose structure you already know. For a payload you have not seen, Gronify prints every path so you can find a value and write the jq filter.
Why big integers change in jq, and how to keep them exact
jq 1.6 and older round integers above 2^53. jq 1.7 and newer keep a number as written until arithmetic touches it. Check your version and keep ids exact.
Let a coding agent search large JSON without reading it all
Keep a coding agent from reading a huge JSON file whole. Gronify shows the shape, counts matches, and prints a capped sample. Agent skill install included.
Try it on your own JSON.
Gronify is open source and MIT licensed. Install it with npm or Homebrew, or read the source first.