title: Looping through this json data with array sub-elements
body: <p>Basically i get a json formatted data from php. I have no control over the data that I get. A sample output is:</p>
  
  <pre><code>var Data={"2":[{"name":"Mr Samuel","votes":"11"}],[{"name":"Mrs Clair Cher","votes":"2"}],"3":[{"name":"Mr Madiex","votes":"13"}]};
  </code></pre>
  
  <p>The data is like this: Mr.Samuel and Mrs Clair work in a department whose id is 2, while Mr.Madiex works in department 3. The votes are the votes  they got for their performance. Now I need to loop through the data, getting name and votes.</p>
  
  <pre><code> $.each(Data, function(departmentid, staffmembers){
   //departmentid is well captured: 2 and 3. But I am having a hard time going thru each departments staff members:
  
    $.each(Data[departmentid], function(index,value){
     //here, i expected that Data[departmentid][index].name would give me name but it is undefined.
     });
  
  
  });
  </code></pre>
  
  <p>What am  I missing exactly?</p>