News for hackers. Stuff that matters.
Re:Gron – Make JSON Greppable by ajholyoake on Saturday November 07, 2020 @08:17AM (#25014900)
I achieve something similar with the following function in ~/.jq

  def flatten_tree: [leaf_paths as $path | {"key":$path | join("."), "value": getpath($path)}] | from_entries;
e.g.

  curl -s http://consul.service.consul:8500/v1/catalog/service/brilliant-service | jq -r 'flatten_tree'
I haven't felt the need to devise the reverse transformation yet, but it works great for grepping blobs of unknown structure

There are no comments on this comment yet.