TL;DR: It would be cool if all CLI apps supported JSON output, but in the meantime we can use jc

  • dotslashme@infosec.pub
    link
    fedilink
    English
    arrow-up
    35
    arrow-down
    1
    ·
    10 months ago

    Not to piss on anyones parade here, but grepping something out of a json structure is one of the most asked questions for jq as well. Of course json is nice, but if the goal is to simplify data extraction, I’m not sure much will be gained by this.

    As far as reducing the toolchain necessary to extract the same data, this is a welcome addition.

    • platypus_plumba@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      10 months ago

      I’ve never been able to successfully write a jq command without having to Google it. It is something so complex and I don’t do it often, so I just forget everything.

      I hope they figure out something with more I tuitive syntax, something SQL-like that people can write without having to look at a manual.

      Anyways, AI is here… pretty soon we’ll just translate natural text to whatever overly complex language there is.

      I’m sure I’ll get replies of people saying jq is easy. It isn’t for me, right now I can t even remember how to filter and create associations between objects. I think I’ll just start writing small python apps to process JSON. A bit longer but at least I can maintain it. The only issue is that Python is too heavy… I’ll figure something out.

  • ishanpage@programming.dev
    link
    fedilink
    arrow-up
    25
    ·
    edit-2
    10 months ago

    While jc is a great tool, and I’m definitely a fan, I believe the real solution to the overarching problem lies in a paradigm shift: see nushell

    • starman@programming.devOP
      link
      fedilink
      English
      arrow-up
      7
      ·
      10 months ago

      I actually use both! It’s so nice to just jc git log and then work with the data using nushell :)

    • Thinker@lemmy.world
      link
      fedilink
      arrow-up
      5
      ·
      10 months ago

      Nushell is so great! I’ve been using it for a couple years. It has completely replaced my need for tools like grep, sed, awk, etc. and because it handles JSON and so many other data formats natively I rarely even need to think about parsing.

    • Lupec@lemm.ee
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      10 months ago

      I’ve always struggled with actually retaining knowledge on how to use the myriad tools you’d usually need to extract/parse data (awk, sed and friends) and this was a game changer. I don’t quite daily drive it just yet but when I do need it, it’s vastly more ergonomic.

  • CubitOom@infosec.pub
    link
    fedilink
    English
    arrow-up
    13
    ·
    10 months ago

    I kinda love it in theory.

    Will be trying this out.

    I do find it funny however that awk is lumped together with these small use case tools like sed, grep, tr, cut, and rev, since awk can be used to replace all of these tools and is it’s own language.

    I don’t think the emphasis should be on simplicity, but rather on understandability (which long awk commands are not either).

    If you give someone a bash script, they should be able to know exactly what the code will do when they read the script without having to run it or cat out the source it might need to parse. Using ubiquitous tools that many people understand is a good step.

    Sadly awk is installed by default in most distros and tools like jq and jc would require installation.

  • hallettj@beehaw.org
    link
    fedilink
    English
    arrow-up
    7
    ·
    10 months ago

    And there is also Nushell and similar projects. Nushell has a concept with the same purpose as jc where you can install Nushell frontend functions for familiar commands such that the frontends parse output into a structured format, and you also get Nushell auto-completions as part of the package. Some of those frontends are included by default.

    As an example if you run ps you get output as a Nushell table where you can select columns, filter rows, etc. Or you can run ^ps to bypass the Nushell frontend and get the old output format.

    Of course the trade-off is that Nushell wants to be your whole shell while jc drops into an existing shell.