HTML-to-JSON Conversion Library Feb 3, 2019 | 1 minute

HTML-to-JSON Library

I have a project here to convert HTML to JSON. You can find installation instructions here: https://gitlab.com/fhightower/html-to-json#installation.

The library can convert any/all html to json such that this:

<head>
    <title>Floyd Hightower's Projects</title>
    <meta charset="UTF-8">
    <meta name="description" content="Floyd Hightower&#39;s Projects">
    <meta name="keywords" content="projects,fhightower,Floyd,Hightower">
</head>

becomes:

{
    "head": [
    {
        "title": [
        {
            "value": "Floyd Hightower\'s Projects"
        }],
        "meta": [
        {
            "attributes":
            {
                "charset": "UTF-8"
            }
        },
        {
            "attributes":
            {
                "name": "description",
                "content": "Floyd Hightower\'s Projects"
            }
        },
        {
            "attributes":
            {
                "name": "keywords",
                "content": "projects,fhightower,Floyd,Hightower"
            }
        }]
    }]
}

And you can tell it to only convert html tables in which case it will convert tables and use the table headings as the keys for the resulting json (this is described in depth here).

Benefits of HTML-to-JSON Library

What is exciting about this library is that it allows you to treat every website like a JSON API. This means you do not have to use beautiful soup or some other HTML parser and traversal system; you can just work with JSON!

Enjoy the project and please contact me if you have any questions or feedback!

© 2021 Floyd Hightower

Powered by Hugo with theme Dream.

avatar
About me

Welcome! I’m Floyd Hightower.

I am a programmer who is passionate about making the world a better place using technology.

Principles

Life Principles

Here are some of the principles I try apply to every area of my life:

  • Let your ideas see the light of day
  • Always be willing to accept feedback and criticism (even when it is poorly delivered)
  • Rome ne s’est pas faite en un jour (Rome wasn’t built in a day)
  • Don’t be too proud to follow a good example
  • Loose ends always unravel
  • Unanswered questions never go away
  • The Tisroc won’t live forever whether you want him to or not
  • Talk less; listen more
  • Use more semi-colons
  • Use oxford commas
  • Learn how to politely say “No”
  • Don’t let the possibility of failure scare you away from starting something
  • To do something, you have to do something
  • A whiteboard is worth a thousand laptops
  • Ideas have consequences