Convert JSON table to HTML in Python
I am using Python JSON library to get data from JSON files using Python.
infoFromJson = json.loads(jsonfile)
I fully understand how to work with JSON files in Python. However, I am trying to find a way to format the JSON format in a nice way.
I prefer to convert JSON to nested HTML table format.
I found json2html for Python, which does exactly what I just described. However, when running the script, they don't output anything.
Anyone have any experience with this tool? Or does anyone have any suggestions for alternatives?
+3
OMGitzMidgar
source
to share
1 answer
Try the following:
infoFromJson = json.loads(jsonfile) print json2html.convert(json = infoFromJson)
The result from json2html.convert
is a string.
If you don't have json2html module:
$ pip install json2html
More examples here .
+5
Kyle shrader
source
to share