Features
- Convert JSON array of objects into to HTML table!
- Convert HTML table into JSON object!
Available configurations:
- data: array(array of objects)
- headers: object(key-value pair index by the number of row and the custom name of the value)
- debug: boolean(we know what debug means :) )
Installation
Using NPM:
npm install htmlson.js
Include:
<script src="node_modules/htmlson.js/dist/htmlson.min.js"></script>
Usage
htmlson.js requires a min version 1.9.1 of jQuery to run.
Initialize:
var htmlson = $('.testTable').htmlson({ data: data, headers: { 1: 'custom header name' }, debug: true });
Convert html table to JSON object:
var obj = htmlson.toJson();
Add row:
htmlson.addRow({ "name": "New Kitty", "species" : "cat", "foods": { "likes": ["old food"], "dislikes": ["new food"] } });
Remove row by index:
htmlson.removeRow(1);
- TODO:
- Write HTML table based on json object depth
Authors: