gron Greppable JSON
Light · Postcard
102 × 152 mm · PDF
Dark · Postcard
102 × 152 mm · PDF
Ink saver · Postcard
102 × 152 mm · PDF
Light · A4 landscape
297 × 210 mm · PDF
Dark · A4 landscape
297 × 210 mm · PDF
Ink saver · A4 landscape
297 × 210 mm · PDF
Light · A3 landscape
420 × 297 mm · PDF
Dark · A3 landscape
420 × 297 mm · PDF
Ink saver · A3 landscape
420 × 297 mm · PDF
Start here
gron <file>
gron <url>
curl -s <url> | gron
gron <file> | grep <text>
gron <file> | grep <text> | gron -u
gron -m <file>
gron -vgron -s <file>
Concepts
- JSON file, URL or stdin
- Assignments json.a.b[0] = 1;
- Fewer lines still valid statements
- JSON again
Reading input
gron <file>
gron <url>
curl -s <url> | gron
gron -gron -s <file>
gron -k <url>
gron -x <proxy> <url>
gron --noproxy <hosts> <url>
Output control
gron -m <file>
gron -c <file> | less -R
gron --no-sort <file>
gron -j <file>
gron --versionSearching
gron <file> | grep <text>
gron <file> | grep -i <text>
gron <file> | grep -v <text>
gron <file> | grep '^json\.<key>'
gron <file> | grep -F '[0]'
gron <file> | grep -E
'<a>|<b>'
gron <file> | grep -c '<text>'
gron <file> | grep '= "'
gron <file> | grep -v '= \[\];\|= {};'
gron <file> | grep -o
'"[^"]*";$'
Rebuilding JSON
gron -u <file>
gron <file> | grep <text> | gron -u
gron --ungrongron -j <file> | grep <text> | gron -j -u
gron <file> | gron -v
gron <file> | sed
's/^json\./json.<new>./' | gron -u
gron <file> | sed -E 's/<a>\.//' | gron
-u
Comparing and editing
diff <(gron <a>) <(gron <b>)
diff -u <(gron <a>) <(gron <b>)
gron <file> | sed
's/<old>/<new>/' | gron -u
gron <file> | grep -v <path> | gron -u
gron <file> > <out>.js
gron <file> | wc -l
Exit codes
| Code | Meaning |
|---|---|
0 |
OK |
1 |
Failed to open file |
2 |
Failed to read input |
3 |
Failed to form statements |
4 |
Failed to fetch URL |
5 |
Failed to parse statements |
6 |
Failed to encode JSON |
Recipes
curl -s <url> | gron | grep -i <text># path found; now query it with jqcurl -s <url> | jq '.items[0].name'
gron <file> | grep '^json.user' | gron -u > user.json
diff <(curl -s <url1> | gron) <(curl -s <url2> | gron)
gron -s <log>.jsonl | grep error# every line is numbered json[n]



