Loop associatuve array

Hello Forums,

How do I loop through an associative array


var myArray = [{'a': 'value1'}, {'b': 'value2'}, {'c':'value3'}];

for (var i = 0; i < myArray.length; i++){
   document.write(myArray[i]);
}

This is giving me [object Object][object Object][object Object]

I want the result to be :
a -value 1
b-value 2
c-value 3

Thanks

NVM
the structure of my json is wrong

var myArray = {'a': 'value1', 'b': 'value2', 'c':'value1'};

for (var key in myArray) {
  if (myArray.hasOwnProperty(key)) {

    document.write(key + " -> " + myArray[key])

  }
}

Cheers