gron

gron transforms JSON into discrete assignments to make it easier to grep, ripgrep for what you want and see the absolute ‘path’ to it.

Usage

Transform JSON (from a file, URL, or stdin) into discrete assignments to make it greppable Usage: gron [OPTIONS] [FILE|URL|-]

Options

OptionDescription
-u, --ungronReverse the operation (turn assignments back into JSON)
-v, --valuesPrint just the values of provided assignments
-c, --colorizeColorize output (default on tty)
-m, --monochromeMonochrome (don’t colorize output)
-s, --streamTreat each line of input as a separate JSON object
-k, --insecureDisable certificate validation
-j, --jsonRepresent gron data as JSON stream
--no-sortDon’t sort output (faster)

Example

Gron turns the following json file:

{
    "key": "value",
    "num": 42,
    "b": true,
    "obj": {
        "sub": "key"
    },
    "lst": [1,2,3]
}

into this:

json = {};
json.b = true;
json.key = "value";
json.lst = [];
json.lst[0] = 1;
json.lst[1] = 2;
json.lst[2] = 3;
json.num = 42;
json.obj = {};
json.obj.sub = "key";