json2table is a ruby library and executable to convert valid JSON objects to
HTML tables. json2table is also available as a rubygem for quick installation.
You can get json2table by install gem or cloning git repo.
Download gem from rubygems as:
$ gem install json2table
Clone this repository as:
$ git clone https://github.com/codeexpress/json2table
If you've installed the gem, json2table is available as a cli command, which can be used as follwing:
$ cat some.json | json2table # outputs table
Refer to the example/example.rb file for sample implementation
require'json2table'# if you've installed the gem#require 'path/to/lib/json2table.rb'# if you've git clone'd the repotable_options={table_style: "border: 1px solid black; max-width: 600px;",table_class: "table table-striped table-hover table-condensed table-bordered",table_attributes: "border=1"}json=STDIN.readjson2table=Json2table::get_html_table(json,table_options)putsjson2tableInvoke example.rb as:
$ cd example
$ cat input.json | ruby example.rb > output.html