title: extract value from subarray or return null using jq
body: <p>So given this input</p>
  
  <pre><code>{
      "id": 1,
      "tags": [
          {
              "Key": "Name",
              "Value": "I am id 1"
          },
          {
              "Key": "Else",
              "Value": "Random"
          }
      ]
  }
  {
      "id": 2,
      "tags": null
  }
  </code></pre>
  
  <p>I would like to get the <code>id</code> and the value of <code>name</code> if exists. So for that input, I would like to get the following output.</p>
  
  <pre><code>{
    "id": 1,
    "name": "I am id 1"
  }
  {
    "id": 2,
    "name": null
  }
  </code></pre>
  
  <p>I tried doing: </p>
  
  <pre><code>jq '{"id": .id, "name": .tags[]|select(.Key=="Name").Value}'
  </code></pre>
  
  <p>but although it extracts when it that key is present, it fails to give <code>null</code> or default value when the path doesn't exist.</p>
  
  <p>Any idea on how to solve this?</p>
  
  <p>You can try out at this jqplay: <a href="https://jqplay.org/s/GgXZg67o79" rel="nofollow noreferrer">https://jqplay.org/s/GgXZg67o79</a></p>