Format.json

Hi did anyone used format.json before…

If so pls, do let me know how to use it…

A link to the api docs may get you started:
http://api.rubyonrails.org/classes/ActiveResource/Base.html#M000827
Also look at the code generated with scaffold. I simply added a json
format.

def index
@sites = Site.find(:all)

respond_to do |format|
  format.html # index.html.erb
  format.xml  { render :xml => @sites.to_xml }

  format.json { render :json => @sites.to_json }
end

end

These are called with the URL:
http://somesite.org/index.html
http://somesite.org/index.xml
http://somesite.org/index.json

HTH
-Dave

On Dec 7, 3:19 am, Ratnavel S. <rails-mailing-l…@andreas-