If I have a block of code like this:
def show @post = Post.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml
It's just like the other formats except that you use render :json instead.
render :json
respond_to do |format| format.html # show.html.erb format.xml { render :xml => @post } format.json { render :json => @post } end