Created
July 15, 2022 20:01
-
-
Save stevenkaspar/7f06b8b544139f681332bea835690c1f to your computer and use it in GitHub Desktop.
HTML Table to JSON
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(() => { | |
const table = document.querySelector('#COVERAGECLASSCODES') | |
const rows = table.querySelectorAll('tr') | |
const data_rows = [] | |
rows.forEach((row) => { | |
const data_row = [] | |
const cells = row.querySelectorAll('td') | |
cells.forEach((cell) => data_row.push(cell.innerText.trim())) | |
const object = { | |
code: data_row[0], | |
system: 'http://terminology.hl7.org/CodeSystem/coverage-class', | |
display: data_row[1], | |
description: data_row[2], | |
version: '4.3.0', | |
} | |
data_rows.push(object) | |
}) | |
console.log(JSON.stringify(data_rows, null, ' ')) | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment