I have a Ruby variable that contains latitude and longitude coordinates:
@json = [{"lat":37.8690058,"lng":-122.2555342},{"lat":37.8739362,"lng":-122.2653001},{"lat":37.8701101,"lng":-122.2578559}]
When I attempt to use this variable in a JavaScript script:
<script type="text/javascript" charset="utf-8">
var test = <%= @json %>
console.log(test);
</script>
Firebug reports an error:
invalid property id
var test = [{"lat":37.869005...707408,"lng":-122.2545767}]
How can I successfully assign the variable in this situation?