Skip to content

Converts JSON objects to HTML Tables - because your users deserve pretty HTML, not a JSON blob

Notifications You must be signed in to change notification settings

FronteraConsulting/json2table

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

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.

Get json2table

You can get json2table by install gem or cloning git repo.

Download gem

Download gem from rubygems as:

$ gem install json2table

Clone git repository

Clone this repository as:

$ git clone https://github.com/codeexpress/json2table

Usage

As a standalone program

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

In your ruby code as library

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 repo

table_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.read

  json2table =  Json2table::get_html_table(json, table_options)
  puts json2table

Invoke example.rb as:

$ cd example
$ cat input.json | ruby example.rb > output.html

About

Converts JSON objects to HTML Tables - because your users deserve pretty HTML, not a JSON blob

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 72.7%
  • Ruby 25.3%
  • Shell 2.0%