我有以下问题: 我从我的mongodb中得到一个dict文档,将其解析为json,并通过jinja将其传递到我的html页面。我尝试在renderjson包中使用这个json文档。我尝试了一些引用jinja对象的解决方案,但它不能正常工作
<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>
我正在尝试使用renderjson包https://github.com/caldwell/renderjson。 如果我改为使用stringfy解析方法,则不会显示任何内容
如何将json正确地传递到前端
目前没有回答
相关问题 更多 >
编程相关推荐