HTML Table to JSON

前端 未结 7 1913
小鲜肉
小鲜肉 2020-11-29 06:56

I need to take table rows and convert to JSON.

Any ideas? I have this code here but it does not work.

function tableToJSON(tableID) {
    return $(t         


        
7条回答
  •  萌比男神i
    2020-11-29 07:11

    I was unhappy with all the solutions above and ended up writing my own jQuery plugin to accomplish this. It is very similar to the solution but accepts several options to customize the results, such as ignoring hidden rows, overriding column names, and overriding cell values

    The plugin can be found here along with some examples if this is more what your looking for: https://github.com/lightswitch05/table-to-json

提交回复
热议问题