{"id":18456550,"url":"https://github.com/akashrajpurohit/html2json","last_synced_at":"2025-08-22T12:12:00.111Z","repository":{"id":42070603,"uuid":"188354496","full_name":"AkashRajpurohit/html2json","owner":"AkashRajpurohit","description":"Scrapes a live website and convert it to JSON format","archived":false,"fork":false,"pushed_at":"2023-12-05T05:15:22.000Z","size":53,"stargazers_count":3,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-14T15:49:12.019Z","etag":null,"topics":["html2json"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AkashRajpurohit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"ko_fi":"akashrajpurohit","github":"AkashRajpurohit","custom":["https://paypal.me/RajpurohitAkash"]}},"created_at":"2019-05-24T04:54:50.000Z","updated_at":"2024-09-03T12:52:27.000Z","dependencies_parsed_at":"2024-11-06T08:12:04.168Z","dependency_job_id":null,"html_url":"https://github.com/AkashRajpurohit/html2json","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AkashRajpurohit/html2json","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AkashRajpurohit%2Fhtml2json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AkashRajpurohit%2Fhtml2json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AkashRajpurohit%2Fhtml2json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AkashRajpurohit%2Fhtml2json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AkashRajpurohit","download_url":"https://codeload.github.com/AkashRajpurohit/html2json/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AkashRajpurohit%2Fhtml2json/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260637073,"owners_count":23040047,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["html2json"],"created_at":"2024-11-06T08:11:59.316Z","updated_at":"2025-06-18T21:34:25.923Z","avatar_url":"https://github.com/AkashRajpurohit.png","language":"JavaScript","funding_links":["https://ko-fi.com/akashrajpurohit","https://github.com/sponsors/AkashRajpurohit","https://paypal.me/RajpurohitAkash"],"categories":[],"sub_categories":[],"readme":"# html2json converts a website into its equivalent JSON format\n\nSample input HTML file server at ```http://localhost:4000```\n\nWebsite:\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n\t\u003cmeta charset=\"UTF-8\"\u003e\n\t\u003ctitle\u003eHello World\u003c/title\u003e\n\u003c/head\u003e\n\u003cbody class=\"body-color\"\u003e\n\t\u003cnav\u003e\n\t\t\u003cul\u003e\n\t\t\t\u003cli\u003e\u003ca href=\"/index.html\"\u003eHome\u003c/a\u003e\u003c/li\u003e\n\t\t\t\u003cli\u003e\u003ca href=\"/about.html\"\u003eAbout\u003c/a\u003e\u003c/li\u003e\n\t\t\t\u003cli\u003e\u003ca href=\"/contact.html\"\u003eContact\u003c/a\u003e\u003c/li\u003e\n\t\t\t\u003cli\u003e\u003ca href=\"/blog.html\"\u003eBlogs\u003c/a\u003e\u003c/li\u003e\n\t\t\u003c/ul\u003e\n\t\u003c/nav\u003e\n\t\u003csection class=\"main\"\u003e\n\t\t\u003ch1 class=\"red full-width\"\u003eHello\u003c/h1\u003e\n\t\t\u003ch3 class=\"blue full-width\"\u003eWorld\u003c/h3\u003e\n\t\t\u003cp\u003eLorem ipsum dolor sit amet, consectetur adipisicing elit. Nulla, laudantium, omnis. Ea quaerat minima, nostrum doloremque repellendus! Ratione quasi, non eligendi quidem at culpa animi vitae id eius corrupti deleniti.\n\t\t\t\u003cimg src=\"https://fakeimg.pl/300/\" alt=\"Some image\" /\u003e\n\t\t\u003c/p\u003e\n\t\u003c/section\u003e\n\t\u003cmain class=\"container\"\u003e\n\t\t\u003cp\u003eThis is some more dummy text\u003c/p\u003e\n\t\t\u003ch4\u003eLorem ipsum dolor sit amet, consectetur adipisicing elit. Quaerat vitae dolor, atque, excepturi numquam cumque ut iusto, odio perferendis cum rem saepe eveniet voluptatum fuga debitis et illo distinctio eligendi!\u003c/h4\u003e\n\t\u003c/main\u003e\n\t\u003cdiv class=\"div_content\"\u003e\n\t\tHi there, this is empty div with no children :(\n\t\u003c/div\u003e\n\t\u003csection class=\"different\"\u003e\n\t\t\u003cp id=\"p-id\" data-attr=\"custom-attribute\"\u003eDifferent section\u003c/p\u003e\n\t\u003c/section\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\nOutput: \n```\n{\n    \"tag\": \"html\",\n    \"attributes\": {\n        \"lang\": \"en\"\n    },\n    \"child\": [\n        {\n            \"tag\": \"head\",\n            \"attributes\": {},\n            \"child\": [\n                {\n                    \"tag\": \"meta\",\n                    \"attributes\": {\n                        \"charset\": \"UTF-8\"\n                    },\n                    \"content\": null,\n                    \"child\": []\n                },\n                {\n                    \"tag\": \"title\",\n                    \"attributes\": {},\n                    \"content\": \"Hello World\",\n                    \"child\": []\n                }\n            ]\n        },\n        {\n            \"tag\": \"body\",\n            \"attributes\": {\n                \"class\": \"body-color\"\n            },\n            \"child\": [\n                {\n                    \"tag\": \"nav\",\n                    \"attributes\": {},\n                    \"child\": [\n                        {\n                            \"tag\": \"ul\",\n                            \"attributes\": {},\n                            \"child\": [\n                                {\n                                    \"tag\": \"li\",\n                                    \"attributes\": {},\n                                    \"child\": [\n                                        {\n                                            \"tag\": \"a\",\n                                            \"attributes\": {\n                                                \"href\": \"/index.html\"\n                                            },\n                                            \"content\": \"Home\",\n                                            \"child\": []\n                                        }\n                                    ]\n                                },\n                                {\n                                    \"tag\": \"li\",\n                                    \"attributes\": {},\n                                    \"child\": [\n                                        {\n                                            \"tag\": \"a\",\n                                            \"attributes\": {\n                                                \"href\": \"/about.html\"\n                                            },\n                                            \"content\": \"About\",\n                                            \"child\": []\n                                        }\n                                    ]\n                                },\n                                {\n                                    \"tag\": \"li\",\n                                    \"attributes\": {},\n                                    \"child\": [\n                                        {\n                                            \"tag\": \"a\",\n                                            \"attributes\": {\n                                                \"href\": \"/contact.html\"\n                                            },\n                                            \"content\": \"Contact\",\n                                            \"child\": []\n                                        }\n                                    ]\n                                },\n                                {\n                                    \"tag\": \"li\",\n                                    \"attributes\": {},\n                                    \"child\": [\n                                        {\n                                            \"tag\": \"a\",\n                                            \"attributes\": {\n                                                \"href\": \"/blog.html\"\n                                            },\n                                            \"content\": \"Blogs\",\n                                            \"child\": []\n                                        }\n                                    ]\n                                }\n                            ]\n                        }\n                    ]\n                },\n                {\n                    \"tag\": \"section\",\n                    \"attributes\": {\n                        \"class\": \"main\"\n                    },\n                    \"child\": [\n                        {\n                            \"tag\": \"h1\",\n                            \"attributes\": {\n                                \"class\": \"red full-width\"\n                            },\n                            \"content\": \"Hello\",\n                            \"child\": []\n                        },\n                        {\n                            \"tag\": \"h3\",\n                            \"attributes\": {\n                                \"class\": \"blue full-width\"\n                            },\n                            \"content\": \"World\",\n                            \"child\": []\n                        },\n                        {\n                            \"tag\": \"p\",\n                            \"attributes\": {},\n                            \"child\": [\n                                {\n                                    \"tag\": \"img\",\n                                    \"attributes\": {\n                                        \"src\": \"https://fakeimg.pl/300/\",\n                                        \"alt\": \"Some image\"\n                                    },\n                                    \"content\": null,\n                                    \"child\": []\n                                }\n                            ]\n                        }\n                    ]\n                },\n                {\n                    \"tag\": \"main\",\n                    \"attributes\": {\n                        \"class\": \"container\"\n                    },\n                    \"child\": [\n                        {\n                            \"tag\": \"p\",\n                            \"attributes\": {},\n                            \"content\": \"This is some more dummy text\",\n                            \"child\": []\n                        },\n                        {\n                            \"tag\": \"h4\",\n                            \"attributes\": {},\n                            \"content\": \"Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quaerat vitae dolor, atque, excepturi numquam cumque ut iusto, odio perferendis cum rem saepe eveniet voluptatum fuga debitis et illo distinctio eligendi!\",\n                            \"child\": []\n                        }\n                    ]\n                },\n                {\n                    \"tag\": \"div\",\n                    \"attributes\": {\n                        \"class\": \"div_content\"\n                    },\n                    \"content\": null,\n                    \"child\": []\n                },\n                {\n                    \"tag\": \"section\",\n                    \"attributes\": {\n                        \"class\": \"different\"\n                    },\n                    \"child\": [\n                        {\n                            \"tag\": \"p\",\n                            \"attributes\": {\n                                \"id\": \"p-id\",\n                                \"data-attr\": \"custom-attribute\"\n                            },\n                            \"content\": \"Different section\",\n                            \"child\": []\n                        }\n                    ]\n                }\n            ]\n        }\n    ]\n}\n```\n\n## Output is stored in a file in ```outputs``` directory","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakashrajpurohit%2Fhtml2json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakashrajpurohit%2Fhtml2json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakashrajpurohit%2Fhtml2json/lists"}