有:
def render
begin
array= [:orange => 1,:limon => 3]
rescue Exception => e
puts e
end
end
如何在一个json中返回一个数组
答案 0 :(得分:3)
def render
begin
array= [:orange => 1,:limon => 3]
render :json => {:array => array},:callback => params[:callback]
rescue Exception => e
puts e
end
end