Parsing and filtering JSON using Jekyll/Liquid
<p>I try to select and use the sub-tree of my navigation, specified in JSON, in Jekyll.</p>

<p>This is the file <em>_data/navigation.json</em>:</p>

<pre><code>    {
    "main": [
        {"text": "a", "children" : [
            {"text": "aa" },
            {"text": "ab" }
            ]},
        {"text": "b", "children": [
            {"text": "ba", "children": [
                {"text": "baa" },
                {"text": "bab" },
                {"text": "bac" }
                ] },
            {"text": "bb", "children": [
                {"text": "bba" },
                {"text": "bbb" },
                {"text": "bbc" }
                ]},
            {"text": "bc", "children": [
                {"text": "bca"},
                {"text": "bcb"}
                ]},
            {"text": "bd" },
            {"text": "be" }
            ]},
        {"text": "d" },
        {"text": "e"},
        {"text": "f" },
        {"text": "g" }
    ] 
}
</code></pre>

<p>Now I want to get the subtree of 'b':</p>

<pre><code>{% assign stuff = site.data.navigation.main | where:"text","b"  %}
</code></pre>

<p>If I print this via <code>{{ stuff }}</code>, jekyll/liquids serves me an one line string representation starting <code>{"text": "b", "children":...</code>, as one could expect. <code>{{stuff | size}}</code> is 1, so I can expect, it is one object, instead a sequence of characters internally. But if I want to go on working with this structure, I get no output,  <code>stuff.text</code>, <code>stuff["text"]</code> and so on does not work.</p>

<p>Has someone a hint for me?</p>