Linux command
gron 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Convert JSON to gron
gron [file.json]
Pipe JSON to gron
curl [api/url] | gron
Filter with grep
gron [file.json] | grep [pattern]
Convert back to JSON
gron [file.json] | grep [filter] | gron -u
Colorize output
gron --color [file.json]
说明
gron transforms JSON into discrete path-value assignments, making it greppable with standard Unix tools. Each JSON value becomes a single line showing its full path from the root. Results can be filtered with grep and converted back to valid JSON using ungron mode (-u), enabling powerful JSON querying without specialized tools.
参数
- -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.
FAQ
What is the gron command used for?
gron transforms JSON into discrete path-value assignments, making it greppable with standard Unix tools. Each JSON value becomes a single line showing its full path from the root. Results can be filtered with grep and converted back to valid JSON using ungron mode (-u), enabling powerful JSON querying without specialized tools.
How do I run a basic gron example?
Run `gron [file.json]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -u, --ungron do in gron?
Convert gron back to JSON.