Skip to content

Comment on Show HN: Flatito, grep for YAML and JSON files

Comments

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.
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.