LinuxCommandLibrary

gron

TLDR

Convert JSON to gron

$ gron [file.json]
copy
Pipe JSON to gron
$ curl [api/url] | gron
copy
Filter with grep
$ gron [file.json] | grep [pattern]
copy
Convert back to JSON
$ gron [file.json] | grep [filter] | gron -u
copy
Colorize output
$ gron --color [file.json]
copy

SYNOPSIS

gron [options] [file]

DESCRIPTION

gron transforms JSON into discrete path-value assignments, making it greppable. Each JSON value becomes a line showing its full path.
The tool enables searching JSON with standard Unix tools like grep. Results can be converted back to valid JSON using ungron mode.
gron makes JSON greppable.

PARAMETERS

FILE

JSON file to process.
-u, --ungron
Convert gron back to JSON.
-s, --stream
Stream processing mode.
--color
Colorize output.
--no-sort
Preserve original order.
-j, --json
Output as JSON.
--help
Display help information.

CAVEATS

Large JSON files produce many lines. Path syntax may vary. Ungron requires valid gron format.

HISTORY

gron was created by Tom Hudson to solve the problem of searching complex JSON structures with traditional Unix tools.

SEE ALSO

jq(1), grep(1), json_pp(1)

Copied to clipboard