Stack Exchange
JSON returns 'Null' error... @object.to_json wrong place?
-Update-
found answer here: json, rails, parse error in javascript 
also, see iltempo's answer below (thanks iltempo)
JSON / GOOGLE MAPS
PlacesController, index respond_to block
    format.json { render json: @places }    

places.js.erb (/assets) 
    var markersArray = <%= @places.to_json %>;
    addMarkerArray(markersArray);

    function addMarkerArray(markersArray) {
        for(var i = 0; i < markersArray.length; i++) {
            var lt = markersArray[i].latitude;
            var lg = markersArray[i].longitude;
            ...
            ...
        }
    )

Firebug Error 
    TypeError: markersArray is null 
    " for(var i = 0; i < markersArray.length; i++) { "  


can you post your full PlacesController?

Brad, thanks for trying to help but finally found stack question that answered it... http://stackoverflow.com/questions/4485856/json-rails-parse-error-in-javascript  thanks again

Right on - I had overlooked the /assets.

You are not able to access the ERB template variable @places in a Javascript file placed in assets/. Instead call the function addMarkerArray() with the return value of the AJAX call you do to get the places data.

Thanks for the response. Finally found a similar stack question here http://stackoverflow.com/questions/4485856/json-rails-parse-error-in-javascript
