I want to render a simple JSON from an array.
array = ["valueid",true]
render :json=>array
which returns:
{"json":["valueid",true]}
but I don't want the JSON. The only part I want is:
["valueid",true]
Is there a simple way?
I want to render a simple JSON from an array.
array = ["valueid",true]
render :json=>array
which returns:
{"json":["valueid",true]}
but I don't want the JSON. The only part I want is:
["valueid",true]
Is there a simple way?
Yep:
get :index do
[:id, 4].to_json
end
Better:
get :index, :provides => :json do
my_array.to_json
end