How to convert the following table to JSON with javascript?

后端 未结 6 1305
孤城傲影
孤城傲影 2020-11-27 19:15

How to make the following table into a JSON string in jquery/javascript?

6条回答
  •  有刺的猬
    2020-11-27 19:47

    I needed the same thing except with the ability to ignore columns, override values, and not be confused by nested tables. I ended up writing a jQuery plugin table-to-json:

    https://github.com/lightswitch05/table-to-json

    All you have to do is select your table using jQuery and call the plugin:

    var table = $('#example-table').tableToJSON();
    

    Here is a demo of it in action:

    http://jsfiddle.net/nyg4z/27/

提交回复
热议问题
Column 1