garyhurtz / html2json.py

Tools for building HTML and parsing HTML into JSON in Python, and rendering HTML from JSON using Jinja.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

html2json.py

Tools for building HTML and parsing HTML into JSON in Python, and rendering HTML from JSON using Jinja.

The JSON data structure follows that used in html2json.js and json2html.js, so that the resulting JSON can (for example) be constructed and/or stored on a Python server, passed to the browser via an AJAX call, then rendered using javascript.

The json2html.html Jinja macro is also compatible with nunjucks, so both server-side and client-side templating are supported. Client-side rendering can also be performed in pure javascript using json2html.js).

The code is pretty straight-forward, and can be easily modified to support alternative JSON data structures from other libraries.

Take a look at the documentation for more information.

About

Tools for building HTML and parsing HTML into JSON in Python, and rendering HTML from JSON using Jinja.


Languages

Language:Python 96.9%Language:HTML 3.1%