Railsでは、to_jsonというメソッドでJSON形式の文字列を生成できます。Ext.jsを使ってみようと思ってを試していたのですが、Rialsレシピブックとちょっと違うと思ったら、2.1から生成されるデータがちょっと変わってました。例えばtitleとauthorというフィールドがあるBookというActiveRecord::Baseを継承したモデルオブジェクトをJSONにすると、 # Bookオブジェクト Book.find(:first).to_json(:only => [:id, :title]) # 配列 Book.find(:all).to_json(:only => [:id, :title]) で得られるJSON形式の文字列は、 // Rails 2.0は // オブジェクト { id: 1 ,title: Agile Web Development with Rail