Markercluster, google maps cant get location object

Markercluster, google maps cant get location object

I want to make a markercluster, where i get my lat/lng values from my database.

When i use this example here:

Then those location values are objects and those are working.
Now I have a loop where i create an array:

  1. lnglatarr.push({
  2. lat: parseFloat(i[l].getAttribute("lat")),
  3. lng: parseFloat(i[l].getAttribute("lng"))
  4. });
// AFTER THAT i send the array to this function:

  1. createcustom (lnglatarr);
Here the function 
  1. function createcustom(arr)
  2. {


  3. locations = JSON.stringify(arr); 
  4. console.log( locations ); // 15
  5. localStorage.setItem('gameStorage', JSON.stringify(locations));
  6. }
When i see the log i get:


en:2910 [{'lat':-6.1472845,'lng':106.81507789999999},{'lat':-6.1463909999999995,'lng':106.815356},{'lat':-3.566773,'lng':102.788227},{'lat':-3.994781,'lng':138.513722},{'lat':-6.1463076,'lng':106.8157078}] 


Now, that data is not accepted by markerclusterer . 

When i use the location data from the example link of google i get this in the console:


  1. [ObjectObjectObjectObjectObjectObjectObjectObjectObjectObjectObjectObjectObjectObjectObjectObjectObjectObjectObjectObjectObjectObjectObject]
    1. 0:Object
    2. 1:Object
    3. 2:Object
    4. 3:Object
    5. 4:Object
    6. 5:Object
    7. 6:Object
    8. 7:Object
    9. 8:Object
    10. 9:Object
    11. 10:Object
    12. 11:Object
    13. 12:Object
    14. 13:Object
    15. 14:Object
    16. 15:Object
    17. 16:Object
    18. 17:Object
    19. 18:Object
    20. 19:Object
    21. 20:Object
    22. 21:Object
    23. 22:Object
    24. length:23


Now, how do i create these objects so , i can use my own data?