knowledge/technology/applications/cli/gron.md

52 lines
No EOL
1.8 KiB
Markdown

---
obj: application
repo: https://github.com/tomnomnom/gron
rev: 2024-02-27
---
# gron
gron transforms [JSON](../../files/JSON.md) into discrete assignments to make it easier to grep, [ripgrep](ripgrep.md) for what you want and see the absolute 'path' to it.
## Usage
Transform [JSON](../../files/JSON.md) (from a file, URL, or stdin) into discrete assignments to make it greppable
Usage: `gron [OPTIONS] [FILE|URL|-]`
### Options
| Option | Description |
| ------------------ | ------------------------------------------------------------------------------ |
| `-u, --ungron` | Reverse the operation (turn assignments back into [JSON](../../files/JSON.md)) |
| `-v, --values` | Print just the values of provided assignments |
| `-c, --colorize` | Colorize output (default on tty) |
| `-m, --monochrome` | Monochrome (don't colorize output) |
| `-s, --stream` | Treat each line of input as a separate [JSON](../../files/JSON.md) object |
| `-k, --insecure` | Disable certificate validation |
| `-j, --json` | Represent gron data as [JSON](../../files/JSON.md) stream |
| `--no-sort` | Don't sort output (faster) |
## Example
Gron turns the following json file:
```json
{
"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";
```