Show HN: Catj – A new way to display JSON files
I was curious if this could be doable with jq, and apparently it is:<p><pre><code>  jq -j '
    [
      [
        paths(scalars)
        | map(
          if type == "number"
          then "[" + tostring + "]"
          else "." + .
          end
        ) | join("")
      ],
      [
        .. | select(scalars) | @json
      ]
    ]
    | transpose
    | map(join(" = ") + "\n")
    | join("") 
  '
</code></pre>
EDIT: Got the string quoting and escaping.<p>EDIT 2: For those who want to save this script, you can put just the jq code in an executable file with the shebang:<p><pre><code>  #!/usr/bin/jq -jf</code></pre>