Ripundeep Gill Ripundeep Gill - 5 months ago 36
JSON Question

Show html generated by using json2html at webpage [Django] [Python]?

Following is my code in view:

for k in RESULTS_LIST[0].iterkeys():
RESULTS[k] = list(results[k] for results in RESULTS_LIST)
html_table = json2html.convert(json=RESULTS)
return render(request,'homepage.html',{'html_table':html_table})

here I am arranging a data fetched from Mongo Db in a JSON named as RESULTS and by using JSON2HTML package, it is successfully generated html table for data given in JSON. To embedd the html table code in a blank division at html page, I am doing:


But it failed to display the table on page. I have tried numerous ways to make it but didn't succeed. Please help me to resolve this issue. if any relevant example, you have done before , then please guide me in a right direction.

JS code is:

$ {
'keyword': null,
'option': null,
'lastDate': null
var search_req = {
$http(search_req) //in case I dont want any response back or
}) //in case I need to check response



I have got solution to this problem in an easy way via using js, which is given below and it worked.