Rails 3.1 and jstree

I am using rails 3.1 with jquery and wanr to use jstree to present
some hierarchical data. I have googled for some guides about how to
achieve that and I have studied the jstree documentation and rails
guides but have not found any useful information
After these studies I think the way to go is

  1. to install the jstree plugin requesting the code in the js manifest
    file and may be also using the ui-theme
  2. render json data from some appropriate action.
    Will that create a appropriate data structure in a .json file or
    will it just define some variables that can be used in the .json file
    as when one render html views ?
  3. How is that data loaded into the jstree plugin ?
    Can one define in the plugin that it should read the .json file,
    or does one have to define some javascript variable to transfer data.
    One can also define a url in the jstree plugin to get data from the
    server. Should that point to an action that generate the .json file as
    a partial ?

I have learned how to use jquery in rails 3.1 when one use remote
attributes and how one use jquery just to use javascript in an
unobtrustrusive way. All this is described in different guides and
railscasts, but I cannot find any similar desccription of how to use
jquery plugins that had to be fed by jsone data.

Any help to understand that process would be much appriciated by me
and also I think by many others

Hoping for some guidances !