I am building webpage with flask and i have a python syntax :
@app.route('/uploads/<filename>')
def uploaded_file(filename):
reader = shapefile.Reader("./uploads/"+filename)
fields = reader.fields[1:]
field_names = [field[0] for field in fields]
buffer = []
for sr in reader.shapeRecords():
atr = dict(zip(field_names, sr.record))
geom = sr.shape.__geo_interface__
buffer.append(dict(type="Feature", \
geometry=geom, properties=atr))
json_string = json.dumps(buffer)
return render_template('view.html',r = json_string))
which gives json response like
[{"type": "Feature", "geometry": {"type": "Point", "coordinates": [595371.8167114258, 28460830.87548828]}, "properties": {"Enabled": 1}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [595508.9202880859, 28465509.365478516]}, "properties": {"Enabled": 1}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [595478.0269165039, 28465540.729675293]}, "properties": {"Enabled": 1}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [595594.5479125977, 28465644.839111328]}, "properties": {"Enabled": 1}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [595690.145690918, 28465719.45727539]}, "properties": {"Enabled": 1}}, {"type": "Feature", "geometry": {"type": "Point", "coordinates": [596209.5372924805, 28465729.346679688]}, "properties": {"Enabled": 1}}, .....etc
which i want to print in html table format with miranda.js
<table class="table table-bordered" id="myTable">
<thead>
<tr>
<th>TYPE</th>
<th>GEOMETRY</th>
<th>GEOMETRY TYPE</th>
<th>COORDINATES</th>
</tr>
</thead>
<tbody id="mydata">
<tr>
<td>[[type]]</td>
<td>[[geometry]]</td>
<td>[[type]]</td>
<td>[[coordinates]]</td>
</tr>
</tbody>
</table>
$("#mydata").mirandajs("{{r}}");
But no thing happens. I just want a way to parse this python obj json to html table. Can u please show me where i did wrong?? or can u show me a way to get my thing done easily