Skip to content Skip to sidebar Skip to footer

Json2html: Not A Valid Json List Python

I have a piece of JSON in a file I would like to convert to HTML. I seen online there is a tool called json2html for python which takes care of this for me. [{ 'name': 'Steve',

Solution 1:

parameter json must be a dictionary object and you pass a list. try this:

_json = { "data" : [{"name": "Steve",
    "timestampe": "2016-07-28 10:04:15",
    "age": 22
}, 
{
    "name": "Dave",
    "timestamp": "2016-07-28 10:04:15",
    "age": 34
}]
}
print json2html.convert(json=_json)

Solution 2:

Try setting the value of _json using json.loads(), as in this answer - Converting json to html table in python

Post a Comment for "Json2html: Not A Valid Json List Python"