Skip to content

Latest commit

 

History

History
97 lines (86 loc) · 1.32 KB

README.md

File metadata and controls

97 lines (86 loc) · 1.32 KB

html-table-to-json

Convert HTML Table (with no rowspan/colspan) to JSON using Python

Input

ID Vendor Product
1 Intel Processor
2 AMD GPU
3 Gigabyte Mainboard

Output

[
    {
        "product": "Processor", 
        "vendor": "Intel", 
        "id": "1"
    }, 
    {
        "product": "GPU", 
        "vendor": "AMD", 
        "id": "2"
    }, 
    {
        "product": "Mainboard", 
        "vendor": "Gigabyte", 
        "id": "3"
    }
]

Input (Without Table Header)

1 Intel Processor
2 AMD GPU
3 Gigabyte Mainboard

Output

[
  [
    "1",
    "Intel",
    "Processor"
  ],
  [
    "2",
    "AMD",
    "GPU"
  ],
  [
    "3",
    "Gigabyte",
    "Mainboard"
  ]
]

TODO

  • Support for nested table
  • Support for buggy HTML table (ie. td instead of th in thead)