JS turning dot seperated strings into hierarchical objects
<p>I'm trying to convert a list of strings to an hierarchical tree.</p>

<p>An example of a JSON I would get would be:</p>

<pre><code>{
    "log_names": [
        "one",
        "one.one",
        "one.two",
        "one.three",
        "one.three.one",
        "two",
        "three",
        "three.one",
        "three.one.three.two",
        "four.one.some.more.stuff"
    ]
}
</code></pre>

<p><strong>output</strong><br>
Here, each level is an object, and each sublogger is a child of it's parent.<br>
Each logger is an object, that might contain other objects that are his subloggers. And moreover, like <code>three.two</code> in <code>three.one.three.two</code>, because there isn't another logger under <code>three.one.three</code>, it would be considered as a single logger and not a father logger. Another example is <code>four.one.some.more.stuff</code>. Because there are no other loggers under <code>four</code>, it would just be a single logger under the same logic as before</p>

<pre><code>{
    "one": {
        "one": { },
        "two": { },
        "three": {
            "one" : { }
        }
    },
    "two": { },
    "three": {
        "one": {
            "three.two" : { }
        }
    },
    "four.one.some.more.stuff" : { }
}
</code></pre>

<p>I'm having difficulty of implementing the above logic (no other sons so it's just one logger and not a father logger).</p>

<p>Some advises or even code examples would be nice </p>