I am using google firebase which returns data in JSON, compared to SQLAlchemy which returns it in something else.
In SQLAlchemy, I can fetch a database, pass it as a variable in flask render_template, and do something like this to display all the tables.
{% for Order in query %}
<tr>
<td>{{ Order.uuid }}</td>
<td>{{ Order.costusd }}</td>
<td>{{ Order.costcry }}</td>
<td>{{ Order.orderinfo }}</td>
<td>{{ Order.userpaid }}</td>
</tr>
{% endfor %}
If I attempt this with firebase/JSON data, it will display empty tables (the amount of tables that I have data in firebase) but with no data. I tried to do order['uuid']. etc for all of them, but that does not work either.
So, I am trying to display my database in the same way that SQLAlchemy can do it, but i am using a NOSQL database that is JSON.
CodePudding user response:
This was a duplicate
Working code to translate the NoSQL data into jinja2 readable:
r = json.dumps(json_onject)
loaded_r = json.loads(r)
return render_template("report.html", items=loaded_r)