title: Best way to navigate a nested JSON in Python?
body: <p>I have tried different for loops trying to iterate through this JSON and I cant figure out how to do it. I have a list of numbers and want to compare it to the &quot;key&quot; values under each object of &quot;data&quot; (For example, Aatrox, Ahri, Akali, and so on) and if the numbers match store the &quot;name&quot;
  value in another list.</p>
  <p>Example:
  listOfNumbers = [266, 166, 123, 283]</p>
  <p>266 and 166 would match the &quot;key&quot; in the Aatrox and Akshan objects respectively  so I would want to pull that name and store it in a list.</p>
  <p>I understant this JSON is mostly accessed by key values rather than being indexed so Im not sure how I would iterate through all the &quot;data&quot; objects in a for loop(s).</p>
  <p>JSON im referencing:</p>
  <pre><code>{
    &quot;type&quot;: &quot;champion&quot;,
    &quot;format&quot;: &quot;standAloneComplex&quot;,
    &quot;version&quot;: &quot;12.2.1&quot;,
    &quot;data&quot;: {
      &quot;Aatrox&quot;: {
        &quot;version&quot;: &quot;12.2.1&quot;,
        &quot;id&quot;: &quot;Aatrox&quot;,
        &quot;key&quot;: &quot;266&quot;,
        &quot;name&quot;: &quot;Aatrox&quot;,
        &quot;title&quot;: &quot;the Darkin Blade&quot;,
        &quot;blurb&quot;: &quot;Once honored defenders of Shurima against the Void, Aatrox and his brethren would eventually become an even greater threat to Runeterra, and were defeated only by cunning mortal sorcery. But after centuries of imprisonment, Aatrox was the first to find...&quot;,
        &quot;info&quot;: {
          &quot;attack&quot;: 8,
          &quot;defense&quot;: 4,
          &quot;magic&quot;: 3,
          &quot;difficulty&quot;: 4
        },
        &quot;image&quot;: {
          &quot;full&quot;: &quot;Aatrox.png&quot;,
          &quot;sprite&quot;: &quot;champion0.png&quot;,
          &quot;group&quot;: &quot;champion&quot;,
          &quot;x&quot;: 0,
          &quot;y&quot;: 0,
          &quot;w&quot;: 48,
          &quot;h&quot;: 48
        },
        &quot;tags&quot;: [
          &quot;Fighter&quot;,
          &quot;Tank&quot;
        ],
        &quot;partype&quot;: &quot;Blood Well&quot;,
        &quot;stats&quot;: {
          &quot;hp&quot;: 580,
          &quot;hpperlevel&quot;: 90,
          &quot;mp&quot;: 0,
          &quot;mpperlevel&quot;: 0,
          &quot;movespeed&quot;: 345,
          &quot;armor&quot;: 38,
          &quot;armorperlevel&quot;: 3.25,
          &quot;spellblock&quot;: 32,
          &quot;spellblockperlevel&quot;: 1.25,
          &quot;attackrange&quot;: 175,
          &quot;hpregen&quot;: 3,
          &quot;hpregenperlevel&quot;: 1,
          &quot;mpregen&quot;: 0,
          &quot;mpregenperlevel&quot;: 0,
          &quot;crit&quot;: 0,
          &quot;critperlevel&quot;: 0,
          &quot;attackdamage&quot;: 60,
          &quot;attackdamageperlevel&quot;: 5,
          &quot;attackspeedperlevel&quot;: 2.5,
          &quot;attackspeed&quot;: 0.651
        }
      },
      &quot;Ahri&quot;: {
        &quot;version&quot;: &quot;12.2.1&quot;,
        &quot;id&quot;: &quot;Ahri&quot;,
        &quot;key&quot;: &quot;103&quot;,
        &quot;name&quot;: &quot;Ahri&quot;,
        &quot;title&quot;: &quot;the Nine-Tailed Fox&quot;,
        &quot;blurb&quot;: &quot;Innately connected to the latent power of Runeterra, Ahri is a vastaya who can reshape magic into orbs of raw energy. She revels in toying with her prey by manipulating their emotions before devouring their life essence. Despite her predatory nature...&quot;,
        &quot;info&quot;: {
          &quot;attack&quot;: 3,
          &quot;defense&quot;: 4,
          &quot;magic&quot;: 8,
          &quot;difficulty&quot;: 5
        },
        &quot;image&quot;: {
          &quot;full&quot;: &quot;Ahri.png&quot;,
          &quot;sprite&quot;: &quot;champion0.png&quot;,
          &quot;group&quot;: &quot;champion&quot;,
          &quot;x&quot;: 48,
          &quot;y&quot;: 0,
          &quot;w&quot;: 48,
          &quot;h&quot;: 48
        },
        &quot;tags&quot;: [
          &quot;Mage&quot;,
          &quot;Assassin&quot;
        ],
        &quot;partype&quot;: &quot;Mana&quot;,
        &quot;stats&quot;: {
          &quot;hp&quot;: 526,
          &quot;hpperlevel&quot;: 92,
          &quot;mp&quot;: 418,
          &quot;mpperlevel&quot;: 25,
          &quot;movespeed&quot;: 330,
          &quot;armor&quot;: 21,
          &quot;armorperlevel&quot;: 3.5,
          &quot;spellblock&quot;: 30,
          &quot;spellblockperlevel&quot;: 0.5,
          &quot;attackrange&quot;: 550,
          &quot;hpregen&quot;: 5.5,
          &quot;hpregenperlevel&quot;: 0.6,
          &quot;mpregen&quot;: 8,
          &quot;mpregenperlevel&quot;: 0.8,
          &quot;crit&quot;: 0,
          &quot;critperlevel&quot;: 0,
          &quot;attackdamage&quot;: 53,
          &quot;attackdamageperlevel&quot;: 3,
          &quot;attackspeedperlevel&quot;: 2,
          &quot;attackspeed&quot;: 0.668
        }
      },
      &quot;Akali&quot;: {
        &quot;version&quot;: &quot;12.2.1&quot;,
        &quot;id&quot;: &quot;Akali&quot;,
        &quot;key&quot;: &quot;84&quot;,
        &quot;name&quot;: &quot;Akali&quot;,
        &quot;title&quot;: &quot;the Rogue Assassin&quot;,
        &quot;blurb&quot;: &quot;Abandoning the Kinkou Order and her title of the Fist of Shadow, Akali now strikes alone, ready to be the deadly weapon her people need. Though she holds onto all she learned from her master Shen, she has pledged to defend Ionia from its enemies, one...&quot;,
        &quot;info&quot;: {
          &quot;attack&quot;: 5,
          &quot;defense&quot;: 3,
          &quot;magic&quot;: 8,
          &quot;difficulty&quot;: 7
        },
        &quot;image&quot;: {
          &quot;full&quot;: &quot;Akali.png&quot;,
          &quot;sprite&quot;: &quot;champion0.png&quot;,
          &quot;group&quot;: &quot;champion&quot;,
          &quot;x&quot;: 96,
          &quot;y&quot;: 0,
          &quot;w&quot;: 48,
          &quot;h&quot;: 48
        },
        &quot;tags&quot;: [
          &quot;Assassin&quot;
        ],
        &quot;partype&quot;: &quot;Energy&quot;,
        &quot;stats&quot;: {
          &quot;hp&quot;: 500,
          &quot;hpperlevel&quot;: 105,
          &quot;mp&quot;: 200,
          &quot;mpperlevel&quot;: 0,
          &quot;movespeed&quot;: 345,
          &quot;armor&quot;: 23,
          &quot;armorperlevel&quot;: 3.5,
          &quot;spellblock&quot;: 37,
          &quot;spellblockperlevel&quot;: 1.25,
          &quot;attackrange&quot;: 125,
          &quot;hpregen&quot;: 9,
          &quot;hpregenperlevel&quot;: 0.9,
          &quot;mpregen&quot;: 50,
          &quot;mpregenperlevel&quot;: 0,
          &quot;crit&quot;: 0,
          &quot;critperlevel&quot;: 0,
          &quot;attackdamage&quot;: 62,
          &quot;attackdamageperlevel&quot;: 3.3,
          &quot;attackspeedperlevel&quot;: 3.2,
          &quot;attackspeed&quot;: 0.625
        }
      },
      &quot;Akshan&quot;: {
        &quot;version&quot;: &quot;12.2.1&quot;,
        &quot;id&quot;: &quot;Akshan&quot;,
        &quot;key&quot;: &quot;166&quot;,
        &quot;name&quot;: &quot;Akshan&quot;,
        &quot;title&quot;: &quot;the Rogue Sentinel&quot;,
        &quot;blurb&quot;: &quot;Raising an eyebrow in the face of danger, Akshan fights evil with dashing charisma, righteous vengeance, and a conspicuous lack of shirts. He is highly skilled in the art of stealth combat, able to evade the eyes of his enemies and reappear when they...&quot;,
        &quot;info&quot;: {
          &quot;attack&quot;: 0,
          &quot;defense&quot;: 0,
          &quot;magic&quot;: 0,
          &quot;difficulty&quot;: 0
        },
        &quot;image&quot;: {
          &quot;full&quot;: &quot;Akshan.png&quot;,
          &quot;sprite&quot;: &quot;champion0.png&quot;,
          &quot;group&quot;: &quot;champion&quot;,
          &quot;x&quot;: 144,
          &quot;y&quot;: 0,
          &quot;w&quot;: 48,
          &quot;h&quot;: 48
        },
        &quot;tags&quot;: [
          &quot;Marksman&quot;,
          &quot;Assassin&quot;
        ],
        &quot;partype&quot;: &quot;Mana&quot;,
        &quot;stats&quot;: {
          &quot;hp&quot;: 560,
          &quot;hpperlevel&quot;: 90,
          &quot;mp&quot;: 350,
          &quot;mpperlevel&quot;: 40,
          &quot;movespeed&quot;: 330,
          &quot;armor&quot;: 26,
          &quot;armorperlevel&quot;: 3,
          &quot;spellblock&quot;: 30,
          &quot;spellblockperlevel&quot;: 0.5,
          &quot;attackrange&quot;: 500,
          &quot;hpregen&quot;: 3.75,
          &quot;hpregenperlevel&quot;: 0.65,
          &quot;mpregen&quot;: 8.175,
          &quot;mpregenperlevel&quot;: 0.7,
          &quot;crit&quot;: 0,
          &quot;critperlevel&quot;: 0,
          &quot;attackdamage&quot;: 52,
          &quot;attackdamageperlevel&quot;: 3.5,
          &quot;attackspeedperlevel&quot;: 4,
          &quot;attackspeed&quot;: 0.638
        }
      }
    }
  }
  </code></pre>