How to format json in rails controller?
===

How to format json in rails controller? Via link_to i'm sending and get in method params[:cat], then i fetch all childrens via parent (params[:cat]), but how to format this all in json format for my jqTree? So it looks like {label : (here goes params[:cat]), children: [{all @search_trees.id}]} ? 
    
    require 'json'
            @search_trees = SearchTree.find(:all, :include => [:designation], :conditions => { :STR_ID_PARENT => params[:cat]})
            #data = "{ label : '10001',  children : [{label : '10111'},{label : '10122'}]  }"
            respond_to do |format|
              format.html # index.html.erb
              format.xml  { render :xml => @search_trees }
              format.json { render :json => data }
            end

I'll fetch a part of question from my long question here: 

> http://stackoverflow.com/questions/11728782/how-to-correctly-do-jquery-tree-in-rails-app