Gron - Make JSON greppable!

a version of gron in a simpler language (closer to js, perhaps at least much of the “logic” fuc def etc…)

https://raw.githubusercontent.com/xonixx/gron.awk/refs/heads/main/gron.awk

lines:361
functions:67

.github.com/xonixx/gron.awk (’.’ off click lol)

the original version

.github.com/tomnomnom/gron (go.lang)

gron transforms JSON into 
discrete assignments 
to make it easier to `grep` for what you want 
and see the absolute 'path' to it. 
It eases the exploration of APIs 
that return large blobs of JSON 
but have terrible documentation.

grep means "global regular expression print"

see also : https://groups.google.com/g/tiddlywiki/c/j3h2AM6Ixes

Grep like function in TW5 possible?

What i am looking for however is a way to only display the “lines” that contain the search string.

Eucaly’s matchfilter plugin does the trick and allow to act like a grep. See discussion here
annoying redirect.groups.google.com/g/tiddlywiki/c/ZKPAwN7e-5E/m/yIlgew9FAQAJ
to
Eucaly's Tiddly World — – powered by TiddlyWiki (v5.1.0)

so if gron-like functionality could be ported into a plugin…

eg

gron "https://api.github.com/repos/tomnomnom/gron/commits?per_page=1" | fgrep "commit.author"
json[0].commit.author = {};
json[0].commit.author.date = "2016-07-02T10:51:21Z";
json[0].commit.author.email = "mail@tomnomnom.com";
json[0].commit.author.name = "Tom Hudson";

(re) turn your filtered data back into JSON

gron "https://api.github.com/repos/tomnomnom/gron/commits?per_page=1" | fgrep "commit.author" | gron --ungron
[
  {
    "commit": {
      "author": {
        "date": "2016-07-02T10:51:21Z",
        "email": "mail@tomnomnom.com",
        "name": "Tom Hudson"
      }
    }
  }
]

idk *tf

This module is entirely inspired by tomnomnom/gron but instead of reinventing the wheel it relies on nodejs+flat.

=0

aint plain text…

everything will be brilliant in the future … and probably some kind of future-y can-opener, fantastic. And everything will be done by computers. Aren’t computers brilliant? They can do anything, except play football, a computer wouldn’t be no good in goal. But they can do anything else virtually. I’n’t virtual reality brilliant? It’s exactly like reality, only you wear an ‘at. I tried wi’ me brothers crash helmet the other day and I fell down t’ stairs. Aren’t hospitals brilliant?

( Fast Show Brilliant_Kid
; )

… deps
.github.com/hughsk/flat

Take a nested Javascript object and flatten it, or unflatten an object with delimited keys.

i forget ppl write all sorts of js library’s theses days

See recent post.

There may be an easy way to adapt the S&R module of TiddlerCommander to match your GREPing aims.

TT

@wiki_user … Can you please use full English words instead of custom abbreviations. We do have a lot of different nationalities here in the forum. For most of them English is not their native language. So it may be hard to guess, what it means.

lg Mario


PS: lg=liebe Grüße / kind regards :wink:

1 Like

tries bon …
je ne sais pas
Là où l’anglais s’arrête et où commencent ses autres influences
http://www.i18nguy.com/chaos.html

Query does not rhyme with very,
Nor does fury sound like bury.

Refer does not rhyme with deafer.

Finally, which rhymes with enough –
Though, through, plough, or dough, or cough?
Hiccough has the sound of cup.
My advice is to give up!!!

bon appétit
( i used translate if that make little sense i defer (responsibility) to the algorithmic deitys )

+…ftr the “brilliant kid” quote is a Yorkshire accent
(like the Four Yorkshiremen by Monty python)