Flattens, transforms, and queries JSON into greppable key-value path lines using the Gronify CLI (gron and ungron workflow). Use when an AI agent needs to flatten JSON, grep JSON, search nested JSON structure, inspect API payloads, diff JSON as sorted text lines, or replace jq with path-based queries.
Instal·la
npx skillscat add 1solomonwakhungu/gronify/gronify-json-flatten-search Instal·la des del registre de SkillsCat.
Gronify
Use Gronify to turn nested JSON into one assignment per path, search those paths, and convert valid gron assignments back to JSON.
Check availability
Run command -v gronify before using the CLI. If it is missing and the user wants it installed, use one of the repository's supported installation paths:
brew install 1solomonwakhungu/tap/gronifyOr build it from a Gronify checkout with Node.js 20 or newer:
cd src/packages/cli
npm ci
npm run build
npm linkDo not claim that Gronify is published on npm. The npm package metadata supports source builds, but the project does not publish through npm.
Choose the command
- Use
gronify flattenwhen the user needs every value paired with its full JSON path. - Use
gronify searchfor path or value filtering. It avoids a separategrepdependency. - Use
gronify unflattenonly for valid gron assignments whose root and parent containers appear before their children.
Prefer stdin when the JSON already comes from another command. Use a file argument when the user supplied a file and reading it directly is clearer.
Flatten JSON
gronify --no-color flatten payload.json
curl -sS https://example.com/api/status | gronify --no-color flattenKeep --no-color in pipelines or captured output. Add --pretty only for terminal reading.
Search JSON paths and values
Plain searches are case-insensitive and treat the search term literally:
gronify --no-color search payload.json status
cat payload.json | gronify --no-color search versionUse --regex only when pattern matching is intended. Quote shell-sensitive patterns:
gronify --no-color search payload.json --regex 'users\[[0-9]+\]\.email'
gronify --no-color search payload.json Alice --case-sensitive
gronify --no-color search payload.json error --countA search with no matches exits successfully and writes a message to stderr. When a script needs an unambiguous result, use --count and inspect the numeric output.
Reconstruct JSON
gronify --no-color unflatten payload.gron
gronify --no-color flatten payload.json | gronify --no-color unflattenDo not overwrite the source JSON during exploration. Write reconstructed JSON to a new file first, parse it, and compare it with the source before replacing anything:
gronify --no-color unflatten edited.gron > reconstructed.json
node -e 'JSON.parse(require("node:fs").readFileSync(process.argv[1], "utf8"))' reconstructed.jsonGronify accepts JSON, not arbitrary JavaScript objects or comments. If parsing fails, report the failing input and error rather than silently rewriting the data.