Getting a google map marker from localStorage?

Getting a google map marker from localStorage?

Hi,
If I use the click event of a google map marker to place it in local storage how would I use it? Will it be as simple as:

  1. function setactivemarker() {
  2.     var activemarker = JSON.parse(localStorage.getItem("activemarker"));
  3.     
  4.     activemarker.setMap(MYDIRMAP.map); // this is a different map than the original one the marker was placed on and I want to reassign it the preceding map.
  5. }

Do I need to use JSON.stringify when I store the active marker? What will activemarker actually be?

Thanks for any help.