Can we go the other way? JSON to Table? That would make this a really useful library for saving table states.
Table-to-JSON
31–33 of 33 posts
Re: Table-to-JSON
#32FYI, I'm not the creator. I just saw it on G+ and thought it's worth sharing.
Re: Table-to-JSON
#33It's a nice start to something that looks pretty useful. There are some things to consider though: What if you have headings as the first column in each row? What if you have headings in the first column, and the first row? Also, what is the use case for data overrides? In my opinion, it completely defeats the purpose when your intention is to take the contents of the table.
The code does not try to be clever: var getHeadings = function(table) { var firstRow = table.find("tr:first").first(); return notNull(opts.headings) ? opts.headings : rowValues(firstRow); }; The code is also going to fall down if you have things like wide/high cells. But HTML tables are so flexible and so routinely abused, I guess the problem is too hard to be solved robustly with any generality.