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
        menus=Menu.find(:all, :conditions =>
     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}
    respond_to do |format|
      format.html { render :json => output }
      format.json { render :json => output }

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).


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