Jsoner
Serialize HTML tables into JSON in Ruby.

Installation
Add this line to your application's Gemfile:
gem 'jsoner'
And then execute:
$ bundle
Or install it yourself as:
$ gem install jsoner
Usage
html = " <table id='example-table'>\n <thead>\n <tr>\n <th>First Name</th>\n <th>Last Name</th>\n <th>Points</th></tr>\n </thead>\n <tbody>\n <tr>\n <td>Jill</td>\n <td>Smith</td>\n <td>50</td></tr>\n <tr>\n <td>Eve</td>\n <td>Jackson</td>\n <td>94</td></tr>\n <tr>\n <td>John</td>\n <td>Doe</td>\n <td>80</td></tr>\n <tr>\n <td>Adam</td>\n <td>Johnson</td>\n <td>67</td></tr>\n </tbody>\n </table>\n eohtml\n\n# Convert HTML table into Json\n\njson = Jsoner.parse(html)\n\n# output json => \n# \n# [ {\"First Name\"=>\"Jill\", \"Last Name\"=>\"Smith\", \"Points\"=>\"50\"},\n# {\"First Name\"=>\"Eve\", \"Last Name\"=>\"Jackson\", \"Points\"=>\"94\"},\n# {\"First Name\"=>\"John\", \"Last Name\"=>\"Doe\", \"Points\"=>\"80\"},\n# {\"First Name\"=>\"Adam\", \"Last Name\"=>\"Johnson\", \"Points\"=>\"67\"} ]\n\n"
THANKS
table-to-json written by @lightswitch05 in JavaScript.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request