title: Convert UL into JSON object
body: <p>I need to convert an entire UL and it's children elements into a JSON object.</p>
  
  <p>This is what we did:</p>
  
  <pre><code>function getData(el) {
      el.find('li').each(function () {
          data.push({ "nome": $(this).find('span').html(), "cargo": $(this).find('strong').html()  });
      });
  }
  </code></pre>
  
  <p>JS Fiddle: <a href="https://jsfiddle.net/cbzo0ef2/2/" rel="nofollow noreferrer">https://jsfiddle.net/cbzo0ef2/2/</a></p>
  
  <p>But all elements are in the same level. In this case, all levels need to be kept.</p>