title: How to normalize a nested json with json_normalize
body: <p>I am trying to create a pandas dataframe out of a nested json. For some reason, I seem to be unable to address the third level.</p>
  <p>My json looks something like this:</p>
  <pre><code>  &quot;numberOfResults&quot;: 376,
    &quot;results&quot;: [
      {
        &quot;name&quot;: &quot;single&quot;,
        &quot;docs&quot;: [
          {
            &quot;id&quot;: &quot;RAKDI342342&quot;,
            &quot;type&quot;: &quot;Culture&quot;,
            &quot;category&quot;: &quot;Culture&quot;,
            &quot;media&quot;: &quot;unknown&quot;,
            &quot;label&quot;: &quot;exampellabel&quot;,
            &quot;title&quot;: &quot;testtitle and titletest&quot;,
            &quot;subtitle&quot;: &quot;Archive&quot; 
  
              ]
          },
          {
            &quot;id&quot;: &quot;GUI6N5QHBPTO6GJ66VP5OXB7GKX6J7ER&quot;,
            &quot;type&quot;: &quot;Culture&quot;,
            &quot;category&quot;: &quot;Culture&quot;,
            &quot;media&quot;: &quot;image&quot;,
            &quot;label&quot;: &quot;more label als example&quot;,
            &quot;title&quot;: &quot;test the second title&quot;,
            &quot;subtitle&quot;: &quot;picture&quot;
            
  </code></pre>
  <p>and so on.</p>
  <p>Within the &quot;docs&quot;-part are all the actual results, starting with &quot;id&quot;. Once all the information is there, the next block starting with &quot;id&quot; simply follows.</p>
  <p>Now I am trying to create a table with the keys id, label and title (for a start) for each of these separate blocks (in this case actual items).</p>
  <p>After defining the search_url (where I get the json from), my code for this currently looks like this:</p>
  <pre><code>result = requests.get(search_url)
  data = result.json()
  data.keys() 
  </code></pre>
  <p>With this, I get told that they dict_keys are the following:</p>
  <pre><code>dict_keys(['numberOfResults', 'results', 'facets', 'entities', 'fulltexts', 'correctedQuery', 'highlightedTerms', 'randomSeed', 'nextCursorMark'])
  </code></pre>
  <p>Given the json from above, I know I want to look into &quot;results&quot; and then further into &quot;docs&quot;. According to the documentation I found, I should be able to achieve this by addressing the results-part directly and then addressing the nested bit by separating the fields with &quot;.&quot;.
  I have now tried the following the code:</p>
  <pre><code>fields = [&quot;docs.id&quot;, &quot;docs.label&quot;, &quot;docs.title&quot;]
  df = pd.json_normalize(data[&quot;results&quot;])
  df[fields]
  </code></pre>
  <p>This works until df[field] - at this stage the programm tells me:</p>
  <pre><code>KeyError: &quot;['docs.id'] not in index&quot;
  </code></pre>
  <p>It does work for the level above though, so if I try the same with &quot;name&quot; and &quot;docs&quot; I get a lovely dataframe. What am I doing wrong? I am still a python and pandas beginner and would appreciate any help very much!</p>
  <p>EDIT:</p>
  <p>The desired dataframe output would look roughly like this:</p>
  <pre><code>    id              label            title  
  0   RAKDI342342     exampellabel     testtitle and titletest    
  </code></pre>