title: How to loop over object with unknown keys and values
body: <p>I get a JSON response of shoe sizes from an API endpoint that looks like this:</p>
  
  <pre><code>data: [{
      0: {
          system: "US",
          sizes: {
              7: {B: 3, C: 6, D: 1, E: 1}
              7.5: {A: 6, B: 7, C: 14, D: 11, E: 2}
              8: {2E: 1, A: 5, B: 32, C: 38, D: 23, …}
              8.5: {2E: 2, A: 9, B: 56, C: 79, D: 61, …}
              9: {2A: 5, 2E: 4, A: 17, B: 92, C: 143, …}
              9.5: {2A: 3, 2E: 3, A: 26, B: 132, C: 194, …}
              10: {2A: 5, 2E: 3, 3A: 1, A: 53, B: 159, …}
          }
      }
  }]
  </code></pre>
  
  <p>The data shows e.g that US size 7 has four different kinds of shapes (B, C, D, E) where 3 people have foots of shape B. In total, 11 people has size 7. The list can contain sizes in US, EU or different systems, and key of shapes can be A-Z or basically anything else.</p>
  
  <p>I want to loop over <code>sizes</code> and create a diagram of how many people that has a certain size, and how many has a certain shape of that size. </p>
  
  <p>What would be the best way to loop over an object like this to get the value of every shape? I would expect it to be an array of sizes. </p>
  
  <p>ES6 or ES7 is fine but I would prefer to do it without jQuery.</p>
  
  <p>EDIT:
  Let me be more clear. 
  First of all I have considered improving data structure but unfortunately that's not an option. </p>
  
  <p>I have tried <code>Object.keys(sizes)</code> which returns an array of the keys. Sure that's one step forward. But I would like to call a function that returns an object with the keys and its values. In my mind, that return value should be something like this:</p>
  
  <pre><code>sizes: [
      {
          size: 7,
          total: 11
          shapes: [
              {name: 'B', value: 3},
              {name: 'C', value: 6},
              {name: 'D', value: 1},
              {name: 'E', value: 1}
          ]
      },{...},{...}
  ]
  </code></pre>
  
  <p>Does that makes sense? Of course, length is not absolutely necessary to include in the object.</p>