title: jq select dynamic items from json
body: <p>I have JSON like this:</p>
  
  <pre><code>{
    "photo_807": "Ih2RnaBTg2o.jpg",
    "photo_604": "zodCm9fQgX8.jpg",
    "photo_130": "4Dx-SUNKBw4.jpg",
    "photo_75": "7COWb8ou1qA.jpg",
    "user_id": 100,
    "owner_id": -2435432542783750,
    "access_key": "fc5275423676514042234324265cc3df7607c",
    "post_id": 380435645368865101,
    "date": 14858616848616779856424245814,
    "text": "",
    "height": 417,
    "width": 740,
    "id": 45624575446886886564368555,
    "album_id": -36
  }
  </code></pre>
  
  <p>I want to get only Photo values, from output i want get this:</p>
  
  <pre><code>"photo_807": "Ih2RnaBTg2o.jpg"
  "photo_604": "zodCm9fQgX8.jpg"
  "photo_130": "4Dx-SUNKBw4.jpg"
  </code></pre>
  
  <p>Now about my problem, from next JSON file i will get photo items with new names like this:</p>
  
  <pre><code>  "photo_181": "Ih2RnaBTg2o.jpg",
    "photo_583": "zodCm9fQgX8.jpg",
    "photo_975": "4Dx-SUNKBw4.jpg",
    "photo_32": "7COWb8ou1qA.jpg",
  </code></pre>
  
  <p>How I can get this values from dynamic items photo_* ?</p>
  
  <p>I try something like this:</p>
  
  <pre><code>  cat  ./json3.txt | jq  '.response.items[].attachments[].photo | select(.photo | startswith("photo"))'
  </code></pre>
  
  <p>But it doesn't work. </p>
  
  <p>When I run :</p>
  
  <pre><code>cat  ./json3.txt | jq  '.response.items[].attachments[].photo'  
  </code></pre>
  
  <p>I got this output with all items:</p>
  
  <pre><code>{
    "photo_807": "Ih2RnaBTg2o.jpg",
    "photo_604": "zodCm9fQgX8.jpg",
    "photo_130": "4Dx-SUNKBw4.jpg",
    "photo_75": "7COWb8ou1qA.jpg",
    "user_id": 100,
    "owner_id": -2435432542783750,
    "access_key": "fc5275423676514042234324265cc3df7607c",
    "post_id": 380435645368865101,
    "date": 14858616848616779856424245814,
    "text": "",
    "height": 417,
    "width": 740,
    "id": 45624575446886886564368555,
    "album_id": -36
  }
  </code></pre>
  
  <p>Can someone help me?</p>
  
  <p>Thanks in advance! </p>