title: Javascript array becomes an object structure
body: <p>I'm experiencing an odd behavior (maybe it isn't odd at all but just me not understanding why) with an javascript array containing some objects.</p>
  
  <p>Since I'm no javascript pro, there might very well be clear explanation as to why this is happening, I just don't know it.</p>
  
  <p>I have javascript that is running in a document. It makes an array of objects similar to this:</p>
  
  <pre><code>var myArray = [{"Id":"guid1","Name":"name1"},{"Id":"guid2","Name":"name2"},...];
  </code></pre>
  
  <p>If I print out this array at the place it was created like JSON.stringify(myArray), I get what I was expecting:</p>
  
  <pre><code>[{"Id":"guid1","Name":"name1"},{"Id":"guid2","Name":"name2"},...]
  </code></pre>
  
  <p>However, if I try to access this array from a child document to this document (a document in a window opened by the first document) the array isn't an array any more.
  So doing JSON.stringify(parent.opener.myArray) in the child document will result in the following:</p>
  
  <pre><code>{"0":{"Id":"guid1","Name":"name1"},"1":{"Id":"guid2","Name":"name2"},...}
  </code></pre>
  
  <p>And this was not what I was expecting - I was expecting to get the same as I did in teh parent document.</p>
  
  <p>Can anyone explain to me why this is happening and how to fix it so that the array is still an array when addressed from a child window/document?</p>
  
  <p>PS. the objects aren't added to the array as stated above, they are added like this:</p>
  
  <pre><code>function objTemp()
  {
      this.Id = '';
      this.Name = '';
  };
  
  var myArray = [];
  
  var obj = new ObjTemp();
  obj.Id = 'guid1';
  obj.Name = 'name1';
  
  myArray[myArray.length] = obj;
  </code></pre>
  
  <p>If that makes any difference.</p>
  
  <p>Any help would be much appreciated, both for fixing my problem but also for better understanding what is going on :)</p>