9

What's you guys' thought about jq?
It's grep, but for json.

Comments
  • 4
    Absolutely awesome
  • 3
    Use it all the time.
  • 4
    Spectacular!
    It's an amazing util. And it's far, far more than just grep :) it's a full blown json scripting language
  • 1
    Hate the thing.
    I Prefer to use python for json parsing in scripts.
  • 3
    @magicMirror yes but what if you have to use bash scripts?

    I'd use js/node if I had the chance to too.
  • 3
    @melezorus34
    Yep. You can't count of the right version of python being present in every env anymore
  • 1
    JSON isn't my format of choice when it comes to shell scripting, but I definitely had some used for it.
    And it seems to work really well.
  • 0
    Is it like XPath?
  • 0
    @Oktokolo yes, and more. As xpath, it supports selection/filter mechanism. But you can also reshape, join, create jsons using it, format as tables or other output fmt
  • 0
    @netikras
    so it is a turing-complete language - like Perl - but for parsing JSON instead of semi-regular (*g*) strings?
  • 1
    @Oktokolo think of it like 'awk for JSON'. IMO it's closer to the AWK language than Perl. It feels like AWK with a taste of SQL (in a sense of field-mapping).

    Just look it up :) There's plenty of code examples.
  • 1
    Fucking awesome
  • 0
    @melezorus34 What platform does not have python, but has bash?

    Python is easier to write scripts for, with no need for obscure cli crap....
  • 0
    @magicMirror responding to this will make the thread go off the rails.
  • 0
    Never heard about it... Sounds interesting...
  • 1
    Amazing util! I use it a lot in CI to insert specific parts from a JSON artifact :)
    Just love it!
Add Comment