JSON2HTML: Not a valid JSON list python -


i have piece of json in file convert html. seen online there tool called json2html python takes care of me.

[{     "name": "steve",     "timestampe": "2016-07-28 10:04:15",     "age": 22 },  {     "name": "dave",     "timestamp": "2016-07-28 10:04:15",     "age": 34 }] 

above json, when using online converter tool - http://json2html.varunmalhotra.xyz/ works great , produces nice table me.

however when install library using pip , run following:

_json = [{     "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) 

i error

 file "/root/.pyenv/versions/venv/lib/python2.7/site-packages/json2html/jsonconv.py", line 162, in iterjson raise exception('not valid json list')  exception: not valid json list 

i ran json through http://jsonlint.com/ , came valid json.

i wondering if have fix this, or point me in right direction on how solve this. can't find documentation on library.

for reference link pypi library - https://pypi.python.org/pypi/json2html

any appreciated, in advance!

parameter json must dictionary object , pass 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) 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -