Skip to content

Instantly share code, notes, and snippets.

View MichalBryxi's full-sized avatar
⛰️
Vacationing

Michal Bryxí MichalBryxi

⛰️
Vacationing
View GitHub Profile
@poteto
poteto / bookmarklet.js
Last active May 9, 2024 23:48
Converts a HTML table with `thead` and `tbody` into an array of objects. You can then use JSON.stringify(json) or copy(json) to your clipboard.
javascript:void%20function(){(function(t){t.extend(t.fn,{tableToJSON:function(){var%20n=this,r=t(%22thead%20th%22,n).map(function(n,r){return%20t(r).text().trim().toLowerCase()});return%20t(%22tbody%20tr%22,n).map(function(n,e){var%20o=t(e),a={};return%20t(%22td%22,o).each(function(n,e){var%20o=r[n];a[o]=t(e).text().trim()}),a}).toArray()}})})(jQuery)}();