title: How to get the key of an array object?
body: <p>Given a JSON respond to a form I need to parse through the JSON elements to find error messages with their associated element the error is tied to. </p>
  
  <p>The data is returned in JSON format with the error messages as the last variable pair looking like this:</p>
  
  <pre><code>"invalid":[{"field1":"Field 1 is required"}]
  </code></pre>
  
  <p>This ends up having an object/array for each error showing the item's name(key) along with the associated error for that field. Given that my error handling form is unaware what the key names will be how do I go about getting both the key and the value out of this object/array? </p>
  
  <p>I'm using dojo on this project and I'm not familiar with it at all so I've been attempting to use dojo functions when possible if something exists that can handle this. Currently there is where I am :</p>
  
  <pre><code>var retObj = dojo.fromJson(ioargs.xhr.responseText);
  
  dojo.forEach(retObj.invalid, function(entry,i){ 
      console.debug(entry);
  });
  </code></pre>
  
  <p>The console output is:</p>
  
  <pre><code>Object { field1="Field 1 is required"}
  </code></pre>
  
  <p>My goal is to pull out the value "field1" so I know which input field this error is assigned to, then to assign the value of field1 to that error field. </p>
  
  <p>Thanks!</p>