0

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?

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
gkaykck
  • 261
  • 1
  • 3
  • 11

1 Answers1

1

Yep:

get :index do
  [:id, 4].to_json
end

Better:

get :index, :provides => :json do
   my_array.to_json
end
DAddYE
  • 1,719
  • 11
  • 16