Convert REST url in javascript literal
<p>I want to convert a REST style url into a javascript literal, like this:</p>

<p>from:</p>

<pre><code>var url = "/a/b/c/d";
</code></pre>

<p>to:</p>

<pre><code>var obj = {
   a:{
     b:{
       c:{
         d:{}
       }
     }
   }
};
</code></pre>

<p>How would you do this?</p>
