Is there a simpler way of calling JSON in a Jinja2 template?

I managed to call in a JSON file into my router and access the content in the template. However, I’m wondering if there’s a simpler way of calling my data. Is there a way to just call for example, and not ? Any help would be greatly appreciated.

    def article_02_welcome():
        with app.open_resource("templates/article-02/data.json", "r" ) as data_file:
            data = json.load(data_file)

    return render_template("article-02/welcome.html", data = data)


<div class="overline">Category: </div>

Leave a Reply

Your email address will not be published. Required fields are marked *