why is this not returning json format!!

I'm ecpecting this to return json format even when the request would be expected to return in html. the output looks like this!

[{"controller": "page", "item": 1, "name": "Home", "id": 2, "action": "show", "submenus": 0}, {"controller": "contact", "item": null, "name": "Account", "id": 5, "action": null, "submenus": 3}, {"controller": null, "item": null, "name": "Admin", "id": 3, "action": null, "submenus": 4}, {"controller": "page", "item": 2, "name": "About", "id": 4, "action": "show", "submenus": 0}]

Which doesn;t look like json to me!! :>

  def getmenu      if params[:id] == '0'         menus=Menu.find(:first, :conditions => "name='root'").children      else         menus=Menu.find(:all, :conditions => "parent_id='#{params[:id]}'")      end      menu=      menus.each do |m|         menu[m.position]={:name => m.name,                           :controller => m.controller,                           :action => m.action,                           :item => m.item,                           :id => m.id,                           :submenus => m.children.size}     end     output=menu.compact.to_json     respond_to do |format|       format.html { render :json => output }       format.json { render :json => output }     end   end

Looks like JSON to me. If anything it's just missing a top-level identifier, but what's there I think is valid (to_json created it after all).

Jason

Actually that is exactly what JSON looks like...what were you expecting?