Permalink
Browse files

Prettify the JSON output.

Rather than calling attributes.to_json, I now use
JSON.pretty_generate(attributes)
  • Loading branch information...
nelstrom committed Feb 25, 2011
1 parent 41b73af commit c6180be5be16e37f18f01488c69ff1aa66a6ece8
Showing with 6 additions and 3 deletions.
  1. +1 −0 Gemfile
  2. +2 −0 Gemfile.lock
  3. +3 −3 application.rb
View
@@ -3,6 +3,7 @@ source "http://rubygems.org"
gem "rake"
gem "activerecord"
gem "sinatra", "~>1.1"
+gem "json"
gem "data_mapper"
gem "dm-core", "1.0.2"
View
@@ -60,6 +60,7 @@ GEM
data_objects (= 0.10.2)
extlib (0.9.15)
fastercsv (1.5.4)
+ json (1.5.1)
json_pure (1.5.1)
linecache (0.43)
rack (1.2.0)
@@ -101,6 +102,7 @@ DEPENDENCIES
dm-validations (= 1.0.2)
do_postgres
do_sqlite3
+ json
rack (= 1.2.0)
rack-test
rake
View
@@ -15,13 +15,13 @@
end
get '/artists/catalogue.json' do
- Catalogue.items(:leaf => :artist).to_json
+ JSON.pretty_generate(Catalogue.items(:leaf => :artist))
end
get '/albums/catalogue.json' do
- Catalogue.items(:leaf => :album).to_json
+ JSON.pretty_generate(Catalogue.items(:leaf => :album))
end
get '/tracks/catalogue.json' do
- Catalogue.items(:leaf => :track).to_json
+ JSON.pretty_generate(Catalogue.items(:leaf => :track))
end

0 comments on commit c6180be

Please sign in to comment.