I want to print the json object in a tabular form passed using render_template() from python
<p>Python code is as follows:</p>

<pre><code>   @app.route("/send", methods=['GET', 'POST'])
    def send():
        if request.method == "POST":
            findemail=request.form['email']
            datafound=findlogic(findemail)
            data = jsonify(datafound)
            #return data
            return render_template("testjinja.html", x=data)
</code></pre>

<p>The data is of the form</p>

<pre><code>"629513533": [
        {
          "xyz": "629513533"
        }, 
        {
          "a": "1.00"
        }, 
        {
          "b": "3.00"
        }, 
        {
          "c": "1.00"
        }, 
        {
          "d": "1.00"
        }, 
        {
          "e": "1.00"
        }, 
        {
          "f": "1.00"
        }, 
        {
          "g": "1.00"
        }, 
        {
          "h": "1.00"
        }, 
        {
          "i": "1.00"
        }, 
</code></pre>

<p>I have tried testjinja.html as follows:</p>

<pre><code>&lt;body&gt;
{% for value in x %}           // I have tried x.iteritems(), x.items() also 
  &lt;li&gt;{{ x[value].xyz }} &lt;/li&gt;
{% endfor %}
&lt;/body&gt;
</code></pre>

<p>I get an error that response object is not iterable.  I dont know how to handle json object x in testjinja.html. PLease help</p>

<p>you cannot iterate a string like you want, but it looks like your <code>data</code> is a json string, so you could do something like:</p>

<pre><code>json_data = json.loads(data)

&lt;body&gt;
{% for value in json_data['629513533'] %}           
  &lt;li&gt;{{ x[value].xyz }} &lt;/li&gt;
{% endfor %}
&lt;/body&gt;
</code></pre>

<p>You will have to <code>import json</code></p>

python html json