The following piece of code should return a json:

  @series = @series.map do |serie| {
    :name => serie.name,
    :id => serie.id
  }

  @series.to_json

It's return is the following:

"[{\"name\":\"Barra\",\"id\":3},{\"name\":\"Botafogo 1\",\"id\":1},{\"name\":\"Botafogo 2\",\"id\":2},{\"name\":\"Tijuca\",\"id\":4}]"

Why is it returning a string instead of a json?

'json' gem is both installed and required at the top of my .rb file

Edit
Report