title: Getting only desired properties from nested array values with jq
body: <p>The structure I ultimately want would be:</p>
  
  <pre><code>{
    "catalog": [
      {
        "name": "X",
        "catalog": [
          { "name": "Y", "uniqueId": "Z" },
          { "name": "Q", "uniqueId": "B" }
        ]
      }
    ]
  }
  </code></pre>
  
  <p>This is what the existing structure looks like except there are <em>many</em> other properties at each level (<a href="https://gist.github.com/ajcrites/e0e0ca4ca3a08ff2dc401ec872e6094c" rel="nofollow noreferrer">https://gist.github.com/ajcrites/e0e0ca4ca3a08ff2dc401ec872e6094c</a>). I just want to filter those out and get a JSON format that looks specifically like this.</p>
  
  <p>I have started out with: <code>jq '.catalog'</code>, but this returns only the array. I still want the <code>catalog</code> property name there. I can do this with <code>jq '{catalog: .catalog[]}</code>, but this prints out each catalog object individually which makes the whole output invalid JSON. I still want the properties to be in the array. Is there a way to filter specific property key-values within arrays using jq?</p>