• ArseAssassin@sopuli.xyz
    link
    fedilink
    arrow-up
    8
    ·
    2 days ago

    I don’t know if we should call someone a master of jq if they do

    echo ‘{“k1”: [{“k2”: [9]}]}’ | jq ‘.k1 | .[0] | .k2 | .[0]’

    Instead of just

    echo ‘{“k1”: [{“k2”: [9]}]}’ | jq ‘.k1[0].k2[0]’

    • MonkderVierte@lemmy.zip
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      20 hours ago

      Both are bad. Make it readable.

      And if you often resort to jq, better use python or at least something like nushell.