Skip to content

damodharheadrun/html-table-to-json

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

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)

About

🔢 Convert HTML Table to JSON using BeautifulSoup

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%