Show HN: Flatito, grep for YAML and JSON files

ceritium | 65 points

This looks cool!

It doesn't do quite the same thing, but a tool I've had good luck with for quick-n-dirty grepping of JSON is gron:

https://github.com/tomnomnom/gron

(which I'm sure I learned about from a thread like this on HN...)

It sort of "flattens out" your JSON to allow you to do whatever you want to it (grepping, for one thing!). Then you can even turn gron's output back into JSON with `ungron`.

Maybe someone will find it a useful toolbox addition, much like the Flatito looks to be!

ratrocket | a month ago

So I see that the name is derived from an esperanto word (apparently meaning "flatter") but in spanish it would also mean a small burp ("flato" being an informal term for burp). Which I still like as a name ;)

dimatura | a month ago

I usually have to use JMESPath queries semi-regularly. Every time I do it feels like I'm starting over for the first time. I'd love something that made more sense to me, but in most cases I'm stuck with what I have due to restrictions on what I can use at work.

al_borland | a month ago

This till doesn't give any context about the keys context, what's the full path of the key? That's critically important.

mutant | a month ago

This is the kind of thing Nushell is already really good at.

gxonatano | a month ago

Is this different from yq?

account-5 | a month ago

What I often use to just get the full key paths is yq (https://github.com/mikefarah/yq), piping into grep when necessary

  yq -o=props <file>
e.g.

  kind = Ingress
  metadata.name = hello
  spec.rules.0.host = localhost
  spec.rules.0.http.paths.0.pathType = ImplementationSpecific
  spec.rules.0.http.paths.0.backend.service.name = hello
  spec.rules.0.http.paths.0.backend.service.port.number = 80
The one drawback I've encountered so far are multi-doc files - yq can certainly handle those, but you have to script the loop yourself.
Yasuraka | a month ago

related project, gron: https://github.com/tomnomnom/gron

    ▶ 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";
llimllib | a month ago