pjotrp / bioruby-table

Swiss knife of tabular data
http://biogems.info/
MIT License
12 stars 7 forks source link

Convert table to JSON #11

Open pjotrp opened 12 years ago

vpereira commented 11 years ago

not so easy if you want to do row based as you are doing with the other formatters. maybe a initial step would be a .to_h method to the Table class?

pjotrp commented 11 years ago

That is an idea.

Check out the RDF outputter. The JSON one should be similar.

vpereira commented 11 years ago

please check my git pull. I added a to_h method to the Table class. now it is possible to do something like:

require './lib/bio-table'
include BioTable
x = TableReader::read_file("./test/data/input/table1.csv")
x.to_h

after that you could do something like x.to_h.to_json