Having troubles extracting json data within javascript

I am having some difficulty extracting json data from a returned hash
table.

From the geocode data that is returned the following
  console.log(data)
  console.log(data["latitude"])

Results in:
  {"latitude": "55.272766", "longitude": "-114.762116"}
  undefined

Checking a javascript created hash
  var foo = {"foo": "footoyou", "bar": "barandbeyond"}
  console.log(foo)
  console.log(foo["foo"])

Shows me
  Object foo=footoyou bar=barandbeyond
  footoyou

So obviously the json data is not is a json form, but rather just text.

Here is my controller code, where coords is the hash table
  respond_to do |format|
    format.js { render :json => coords.to_json, :layout => false}
  end

I am getting the exact same output if I use :json => coords.to_json or
just :json => coords

Help is appreciated.

Just after I post I find that the following works
  console.log(eval('(' + data + ')'))

Is there a cleaner way of doing this?

Just after I post I find that the following works
console.log(eval('(' + data + ')'))

Is there a cleaner way of doing this?

if you are using prototype you could use data.evalJSON(true)

See: http://www.prototypejs.org/api/string/evalJSON