Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I just use gron then grep for what I'm looking for.


Does it do more than just grep? That's awfully limited compared to what jq can do. I personally like jless for just searching and exploring.


gron is great, i have this in my init.jq file for fq (https://github.com/wader/fq). Sadly jq lacks a path_to_expr function so a bit harder to do it with that.

  def gron:
    ( path(..) as $p
    | getpath($p)
    | scalars
    | "\($p | path_to_expr) = \(tojson)"
    | println
    );
Ex:

  $ fq gron <<< '{"a": [1,2,{"b": 3}]}'
  .a[0] = 1
  .a[1] = 2
  .a[2].b = 3
Great for copy/paste into other expressions when poking around.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: