Export data to Json

Export data to Json

macmicromacmicro Posts: 19Questions: 0Answers: 0

Hello,

excuse me for my english, i translated the text via google

I wanted to share with you my discovery about exporting
data from a table to JSon

The original code does not allow to have a valid Json code
because it contains the data of the header, the footer and the html icons
in table cells

while searching for a long time, I came across this link
https://github.com/lightswitch05/table-to-json

it is very easy to use
for the button code i used it like this

{

text: 'JSON',
action: function ( e, dt, button, config ) {

var table = $('#menuTable').tableToJSON({
  ignoreColumns: [7]

}); 

$.fn.dataTable.fileSave(
new Blob( [ JSON.stringify(table,null,'\t') ] ),
    'Export.json'
)

}
},

Macmicro

Replies

This discussion has been closed.