title: Creating a JSON Tree from a string hierarchy
body: <p>Given these 4 variables,</p>
  
  <pre><code>var el1 = {name:'ronaldo', team: 'europe/spain/realmadrid'}
  var el2 = {name:'messi', team: 'europe/spain/barcelona'}
  var el3 = {name:'gerald', team: 'europe/england/liverpool'}
  var el4 = {name:'unknown english', team: 'europe/england'}
  </code></pre>
  
  <p>I need to produce this JSON tree hierarchy,</p>
  
  <pre><code>{
      "text":"europe",
      "leaf":false,
      "children":[
          {
              "text":"spain",
              "leaf":false,
              "children":[
                  {
                      "text":"realmadrid",
                      "leaf":false,
                      "children":[
                          {
                              "text":"ronaldo",
                              "leaf":true
                          }
                      ]
                  },
                  {
                      "text":"barcelona",
                      "leaf":false,
                      "children":[
                          {
                              "text":"messi",
                              "leaf":true
                          }
                      ]
                  }
              ]
          },
          {
              "text":"england",
              "leaf":false,
              "children":[
                  {
                      "text":"unknown english",
                      "leaf":true
                  },
                  {
                      "text":"liverpool",
                      "leaf":false,
                      "children":[
                          {
                              "text":"gerald",
                              "leaf":true
                          }
                      ]
                  }
              ]
          }
      ]
  }
  </code></pre>