Gathering detailed insights and metrics for tableasjson
Gathering detailed insights and metrics for tableasjson
Gathering detailed insights and metrics for tableasjson
Gathering detailed insights and metrics for tableasjson
npm install tableasjson
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (91.02%)
HTML (8.98%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
16 Commits
1 Watchers
1 Branches
1 Contributors
Updated on May 25, 2018
Latest Version
0.5.0
Package Id
tableasjson@0.5.0
Size
10.11 kB
NPM Version
4.4.1
Node Version
6.10.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
(Forked from https://github.com/iaincollins/tabletojson)
Attempts to convert HTML tables into JSON.
Can be passed the markup for a single table as a string, a fragment of HTML or an entire page or just a URL (with an optional callback function; promises also supported).
The response is always an array. Every array entry in the response represents a table found on the page (in same the order they were found in the HTML).
This module only supports parsing basic tables with a simple horizontal set of headings and corresponding cells.
It can give useless results on tables that have complex structures or multiple headers (such as on both X and Y axis).
You'll need to handle things like work out which tables to parse and (in most cases) clean up the data. You might want to combine it it with modules like json2csv.
You might want to use it with a module like 'cheerio' if you want to parse specific tables identified by id or class (i.e. select them with cheerio and pass the HTML of them as a string).
1// Convert an HTML blob into an array of all the tables on the page 2var tabletojson = require('tableasjson'); 3var tablesAsJson = tabletojson.convert(html); 4var firstTableAsJson = tablesAsJson[0]; 5var secondTableAsJson = tablesAsJson[1]; 6...
1// Fetch a URL and parse all it's tables into JSON, using a callback 2var tabletojson = require('tableasjson'); 3var url = 'https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes'; 4tabletojson.convertUrl(url, function(tablesAsJson) { 5 var listofSovereignStates = tablesAsJson[0]; 6});
1// Fetch a URL and parse all it's tables into JSON, using promises 2var tabletojson = require('tableasjson'); 3var url = 'http://en.wikipedia.org/wiki/List_of_countries_by_credit_rating'; 4tabletojson.convertUrl(url) 5.then(function(tablesAsJson) { 6 var standardAndPoorRatings = tablesAsJson[0]; 7 var fitchRatings = tablesAsJson[1]; 8});
1// Fetch a table from Wikipedia and combine with json2csv to convert to CSV 2var tabletojson = require('tableasjson'); 3var json2csv = require('json2csv'); 4var url = 'http://en.wikipedia.org/wiki/List_of_countries_by_credit_rating'; 5tabletojson.convertUrl(url) 6.then(function(tablesAsJson) { 7 var standardAndPoorCreditRatings = tablesAsJson[0]; 8 json2csv({ data: standardAndPoorCreditRatings, 9 fields: [ 'Country', 'Outlook'] 10 }, function(err, csv) { 11 console.log(csv); 12 /* Example output 13 "Country","Outlook" 14 "Abu Dhabi, UAE","Stable" 15 "Albania","Stable" 16 "Andorra","Negative" 17 "Angola","Stable" 18 "Argentina","Negative" 19 "Aruba","Stable" 20 "Australia","Stable" 21 "Austria","Negative" 22 "Azerbaijan","Positive" 23 ... 24 */ 25 }); 26});
Improvements, fixes and suggestions for better written modules that other people have created are welcome, as are bug reports against specific tables it is unable to handle.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
no SAST tool detected
Details
Reason
Found 0/16 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More