I have a large json from my rails controller:
@json = {:Nodes => @nodes.as_json(:only => [:ID, :Lat, :Lon])}
and I want to use it in my javascript in my views. In a larger scope, I want to use the json to retrieve lat and lon's to plot on a Google Map. However, right now, I'm just trying to see if I can get all the points properly. My question is:
What's a good way to parse the json in the javascript file? (Note: the file's extension is still html.erb) I've tried:
var stuff = eval('(' + <%= @json %> + ')');
but that doesn't seem to be working. Can anyone help? Thanks so much!
pre within a comment)