I have the following code in my app.rb file:
require 'sinatra'
require 'json'
require 'sqlite3'
get '/api/clients' do
db = SQLite3::Database.new "db/db"
db.results_as_hash = true
{clients: db.execute('SELECT * FROM clients')}.to_json
end
Inspecting the results in the browser, we see this:
Why is the hash as well as the array being returned when I've set db.results_as_hash = true
?