title: How to Remove Outer Layer of JSON in Python
body: <p>I am trying to remove the outer (parent) layer of a JSON file so that I can process it, however I have no idea how. </p>
  
  <p>As you will see by the code below, the outer 2 most layers are 2 dictionaries, however, python says the 2nd dictionary ("item") is just a string when I call its type. Am I incorrect in how I interpret the structure?</p>
  
  <pre><code>sample_object6 = {
      "items":
          {
              "item":
                  [
                      {
                          "id": "0001",
                          "type": "donut",
                          "name": "Cake",
                          "ppu": 0.55,
                          "batters":
                              {
                                  "batter":
                                      [
                                          { "id": "1001", "type": "Regular" },
                                          { "id": "1002", "type": "Chocolate" },
                                          { "id": "1003", "type": "Blueberry" },
                                          { "id": "1004", "type": "Devil's Food" }
                                      ]
                              },
                          "topping":
                              [
                                  { "id": "5001", "type": "None" },
                                  { "id": "5002", "type": "Glazed" },
                                  { "id": "5005", "type": "Sugar" },
                                  { "id": "5007", "type": "Powdered Sugar" },
                                  { "id": "5006", "type": "Chocolate with Sprinkles" },
                                  { "id": "5003", "type": "Chocolate" },
                                  { "id": "5004", "type": "Maple" }
                              ]
                      },
                      {
                          "id": "0002",
                          "type": "donut",
                          "name": "Raised",
                          "ppu": 0.55,
                          "batters":
                              {
                                  "batter":
                                      [
                                          { "id": "1001", "type": "Regular" }
                                      ]
                              },
                          "topping":
                              [
                                  { "id": "5001", "type": "None" },
                                  { "id": "5002", "type": "Glazed" },
                                  { "id": "5005", "type": "Sugar" },
                                  { "id": "5003", "type": "Chocolate" },
                                  { "id": "5004", "type": "Maple" }
                              ]
                      },
  
                      {
                          "id": "0003",
                          "type": "donut",
                          "name": "Old Fashioned",
                          "ppu": 0.55,
                          "batters":
                              {
                                  "batter":
                                      [
                                          { "id": "1001", "type": "Regular" },
                                          { "id": "1002", "type": "Chocolate" }
                                      ]
                              },
                          "topping":
                              [
                                  { "id": "5001", "type": "None" },
                                  { "id": "5002", "type": "Glazed" },
                                  { "id": "5003", "type": "Chocolate" },
                                  { "id": "5004", "type": "Maple" }
                              ]
                      },
                      {
                          "id": "0004",
                          "type": "bar",
                          "name": "Bar",
                          "ppu": 0.75,
                          "batters":
                              {
                                  "batter":
                                      [
                                          { "id": "1001", "type": "Regular" },
                                      ]
                              },
                          "topping":
                              [
                                  { "id": "5003", "type": "Chocolate" },
                                  { "id": "5004", "type": "Maple" }
                              ],
                          "fillings":
                              {
                                  "filling":
                                      [
                                          { "id": "7001", "name": "None", "addcost": 0 },
                                          { "id": "7002", "name": "Custard", "addcost": 0.25 },
                                          { "id": "7003", "name": "Whipped Cream", "addcost": 0.25 }
                                      ]
                              }
                      },
  
                      {
                          "id": "0005",
                          "type": "twist",
                          "name": "Twist",
                          "ppu": 0.65,
                          "batters":
                              {
                                  "batter":
                                      [
                                          { "id": "1001", "type": "Regular" },
                                      ]
                              },
                          "topping":
                              [
                                  { "id": "5002", "type": "Glazed" },
                                  { "id": "5005", "type": "Sugar" },
                              ]
                      },
  
                      {
                          "id": "0006",
                          "type": "filled",
                          "name": "Filled",
                          "ppu": 0.75,
                          "batters":
                              {
                                  "batter":
                                      [
                                          { "id": "1001", "type": "Regular" },
                                      ]
                              },
                          "topping":
                              [
                                  { "id": "5002", "type": "Glazed" },
                                  { "id": "5007", "type": "Powdered Sugar" },
                                  { "id": "5003", "type": "Chocolate" },
                                  { "id": "5004", "type": "Maple" }
                              ],
                          "fillings":
                              {
                                  "filling":
                                      [
                                          { "id": "7002", "name": "Custard", "addcost": 0 },
                                          { "id": "7003", "name": "Whipped Cream", "addcost": 0 },
                                          { "id": "7004", "name": "Strawberry Jelly", "addcost": 0 },
                                          { "id": "7005", "name": "Rasberry Jelly", "addcost": 0 }
                                      ]
                              }
                      }
                  ]
          }
  }
  </code></pre>
  
  <p>I thought that it might be possible to store the nested portion starting at the first list (right after 'item') in a variable and then work with this but if I can't get python to see that item is a dictionary inside the item<strong>s</strong> dictionary, then I fear I am at a loss with how to proceed.</p>
  
  <p>Does anyone know what I am doing wrong?</p>
  
  <p>Thank you in advance!</p>
  
  <p>As far as the processing goes, there has been none because I could not even get the string to read as a dictionary appropriately.</p>
  
  <p>This is what I tried to test if it was a dictionary:</p>
  
  <pre><code>for i in sample_object6:
      print(i + str(type(i)))
      for n in i["item"]:
          print(n + str(type(n)))
  </code></pre>