jless icon indicating copy to clipboard operation
jless copied to clipboard

Implement ability to search for specific keys using dot-style JSON "path" syntax

Open cohml opened this issue 9 months ago • 1 comments

Say I have the following JSON:

{
  "a": [
    {
      "a": [
        "a"
      ]
    }
  ]
}

If I do /a, I'll get three matches. But what if I'm looking for a specific one? This can get really hairy if the JSON is large and heavily nested.

If I want to specifically search for a.a, it'd be super handy to be able to do that directly. Something like /a.a, but obviously something more robust than basic / search would be required lest the keys themselves actually have . in them.

Currently, AFAIK doing this requires leaving jless and reentering it with a jq pipe e.g., jq 'a.a' < file.json | jless. Kind of a pain, especially if I have multiple things to search for.

Alternatively, if this feature is already implemented, please update the :h docs to reflect this, because I didn't see anything about it.

cohml avatar Mar 25 '25 14:03 cohml

See #167

asharpe avatar Apr 12 '25 01:04 asharpe