0

I have the following issue: I get from my mongodb an dict document, I parse it to json and pass it trough with jinja to my html page. I try to use this json document with the renderjson package. I have tried some solutions with quote the jinja object but it's working not properly.

<div id="test"></div>
<script type="text/javascript" src="static/renderjson.js"></script>
<script>

    var str = "{{meta[1][0]}}" // meta is my list, the json object is the first element from flask
    document.getElementById("test").appendChild(
        renderjson(JSON.stringify(str))
    );
</script>

The json is valid. enter image description here

I am trying to use the renderjson package. https://github.com/caldwell/renderjson. If I use instead stringfy the parse method, nothing is displayed.

How can I pass the json to the frontend properly?

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.