tabletojson
Version:
Convert HTML tables to JSON objects
15 lines (14 loc) • 396 B
text/typescript
import {tabletojson} from '../lib/Tabletojson';
import * as fs from 'fs';
import * as path from 'path';
const html = fs.readFileSync(path.resolve(process.cwd(), '../test/tables.html'), {
encoding: 'utf-8',
});
const converted = tabletojson.convert(html, {
id: ['table15'],
headers: {
to: 2,
concatWith: ' ',
},
});
console.log(JSON.stringify(converted, null, 2));