From: Phil Tayo Date: 2010-02-19T09:25:02+09:00 Subject: Re: Convert Sequel Dataset to JSON Object Jeremy Evans wrote: > FYI, a Sequel dataset is an abstract representation of an SQL query, it > doesn't contain any records itself. Assuming that Array#to_json works > correctly, you could define: > > class Sequel::Dataset > def to_json > all.to_json > end > end > > and then call to_json on a dataset to get the query results in JSON > format. Thanks for that. A couple of problems I still have though: 1. I tried: ... Task.all.to_json ... and ".all" still returned an array of object references without the actual values, like this: ["#","#","#","#","#","#","#"] 2. Once that's working, where should I put this code: > class Sequel::Dataset > def to_json > all.to_json > end > end Can you point me in the direction of any useful reading material? Thanks in advance, Phil -- Posted via http://www.ruby-forum.com/.