{"id":22477134,"url":"https://github.com/zorapeteri/bookmarks-to-json","last_synced_at":"2025-08-02T13:30:48.814Z","repository":{"id":40656044,"uuid":"403329594","full_name":"zorapeteri/bookmarks-to-json","owner":"zorapeteri","description":"Convert browser-exported HTML bookmarks to JSON format","archived":false,"fork":false,"pushed_at":"2023-07-09T12:59:40.000Z","size":327,"stargazers_count":27,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-13T14:13:12.483Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://zorapeteri.github.io/bookmarks-to-json/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zorapeteri.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-05T14:28:00.000Z","updated_at":"2024-10-07T05:20:45.000Z","dependencies_parsed_at":"2022-08-26T13:02:53.539Z","dependency_job_id":null,"html_url":"https://github.com/zorapeteri/bookmarks-to-json","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zorapeteri%2Fbookmarks-to-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zorapeteri%2Fbookmarks-to-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zorapeteri%2Fbookmarks-to-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zorapeteri%2Fbookmarks-to-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zorapeteri","download_url":"https://codeload.github.com/zorapeteri/bookmarks-to-json/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228476049,"owners_count":17926134,"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":[],"created_at":"2024-12-06T14:09:36.361Z","updated_at":"2024-12-06T14:09:36.854Z","avatar_url":"https://github.com/zorapeteri.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bookmarks-to-json\n\nbookmarksToJSON is a no-dependecy, Regex-based pure JS function that takes in the HTML-style code of the bookmarks files exported by browsers like Chrome and Firefox, and converts them into JSON / JS object format with a recursive tree structure.\n\nBookmarks, folders and subfolders are nested using a `children` property on the folders.\n\n## usage\n\n`npm i bookmarks-to-json`\n\n```js\nimport fs from 'fs'\nimport { bookmarksToJSON } from 'bookmarks-to-json'\n\nconst content = fs.readFileSync('bookmarks.html', 'utf-8')\nconst options = { \n  formatJSON: true, // return prettified JSON - false by default\n  spaces: 2 // number of spaces to use for indentation - 2 by default\n}\nfs.writeFileSync('bookmarks.json', bookmarksToJSON(content, options))\n```\n\n```json\nbookmarks.json\n\n[\n  {\n    \"type\": \"link\",\n    \"addDate\": 1630524312,\n    \"title\": \"GitHub\",\n    \"url\": \"https://github.com/\"\n  },\n  {\n    \"type\": \"folder\",\n    \"addDate\": 1630524192,\n    \"lastModified\": 1630524211,\n    \"title\": \"Bookmarks bar\",\n    \"children\": [\n      {\n        \"type\": \"link\",\n        \"addDate\": 1630524211,\n        \"title\": \"Lettuce\",\n        \"url\": \"https://www.youtube.com/watch?v=M9PAXeKHw7Q\"\n      }\n    ]\n  }\n]\n```\n\n```js\nimport fs from 'fs'\nimport { bookmarksToJSON } from 'bookmarks-to-json'\n\nconst content = fs.readFileSync('bookmarks.html', 'utf-8')\nconst options = { stringify: false } // returns JS object, not stringified JSON\nconsole.log(bookmarksToJSON(content, options).map(({ title, type }) =\u003e ({ title, type })))\n\n// [\n//   { title: 'GitHub', type: 'link' },\n//   { title: 'Bookmarks bar', type: 'folder' },\n// ]\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzorapeteri%2Fbookmarks-to-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzorapeteri%2Fbookmarks-to-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzorapeteri%2Fbookmarks-to-json/lists"}