{"id":16758133,"url":"https://github.com/foo123/svg2json","last_synced_at":"2026-02-11T04:31:49.935Z","repository":{"id":143020785,"uuid":"578909876","full_name":"foo123/svg2json","owner":"foo123","description":"Parse SVG to JSON","archived":false,"fork":false,"pushed_at":"2024-12-10T14:01:08.000Z","size":25,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T02:45:21.243Z","etag":null,"topics":["json","svg","svg-parser"],"latest_commit_sha":null,"homepage":"","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/foo123.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}},"created_at":"2022-12-16T07:13:40.000Z","updated_at":"2025-03-01T17:59:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"84e64d9c-658b-4f95-86fb-19ebfa85006f","html_url":"https://github.com/foo123/svg2json","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"9e8d2c80e6d6fc90fb11625c6f34268a558fb282"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/foo123/svg2json","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2Fsvg2json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2Fsvg2json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2Fsvg2json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2Fsvg2json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/foo123","download_url":"https://codeload.github.com/foo123/svg2json/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2Fsvg2json/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29327091,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T03:52:29.695Z","status":"ssl_error","status_checked_at":"2026-02-11T03:52:23.094Z","response_time":97,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["json","svg","svg-parser"],"created_at":"2024-10-13T04:04:14.849Z","updated_at":"2026-02-11T04:31:49.916Z","avatar_url":"https://github.com/foo123.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# svg2json\n\nSimple utility to parse SVG to JSON\n\n**version: 2.0.0** (10 kB minified)\n\n\nExample (see tests):\n\n```javascript\nconst svg2json = require('../src/svg2json.js');\n\nconst svg = String(require('fs').readFileSync(__dirname + '/test.svg', {encoding: 'ascii'}));\nconsole.log(svg);\n\nconst json = svg2json(svg);\nconsole.log(JSON.stringify(json, null, 2));\n```\n\noutput:\n\n```html\n\u003csvg\n  viewBox=\"0 0 10 10\"\n  xmlns=\"http://www.w3.org/2000/svg\"\n  xmlns:xlink=\"http://www.w3.org/1999/xlink\"\u003e\n  \u003cdefs\u003e\n    \u003clinearGradient id=\"myGradient\" gradientTransform=\"rotate(90)\"\u003e\n      \u003cstop offset=\"5%\" stop-color=\"gold\" /\u003e\n      \u003cstop offset=\"95%\" stop-color=\"red\" /\u003e\n    \u003c/linearGradient\u003e\n  \u003c/defs\u003e\n\n  \u003c!-- using my linear gradient --\u003e\n  \u003ccircle cx=\"5\" cy=\"5\" r=\"4\" fill=\"url('#myGradient')\" /\u003e\n\u003c/svg\u003e\n```\n\n```json\n[\n  {\n    \"type\": \"SVG\",\n    \"viewBox\": [\n      0,\n      0,\n      10,\n      10\n    ],\n    \"width\": null,\n    \"height\": null,\n    \"nodes\": [\n      {\n        \"type\": \"Defs\",\n        \"nodes\": [\n          {\n            \"type\": \"linearGradient\",\n            \"atts\": {\n              \"id\": \"myGradient\",\n              \"gradienttransform\": [\n                [\n                  \"rotate\",\n                  [\n                    90\n                  ]\n                ]\n              ]\n            },\n            \"id\": \"myGradient\",\n            \"stops\": [\n              {\n                \"type\": \"Stop\",\n                \"atts\": {\n                  \"offset\": \"5%\",\n                  \"stop-color\": \"gold\"\n                }\n              },\n              {\n                \"type\": \"Stop\",\n                \"atts\": {\n                  \"offset\": \"95%\",\n                  \"stop-color\": \"red\"\n                }\n              }\n            ]\n          }\n        ]\n      },\n      {\n        \"type\": \"Circle\",\n        \"atts\": {\n          \"cx\": \"5\",\n          \"cy\": \"5\",\n          \"r\": \"4\",\n          \"fill\": \"url('#myGradient')\"\n        },\n        \"center\": [\n          5,\n          5\n        ],\n        \"radius\": 4\n      }\n    ]\n  }\n]\n```\n\n**see also:**\n\n* [CanvasLite](https://github.com/foo123/CanvasLite) an html canvas implementation in pure JavaScript\n* [Rasterizer](https://github.com/foo123/Rasterizer) stroke and fill lines, rectangles, curves and paths, without canvaσ\n* [Gradient](https://github.com/foo123/Gradient) create linear, radial, conic and elliptic gradients and image patterns without canvas\n* [Geometrize](https://github.com/foo123/Geometrize) Computational Geometry and Rendering Library for JavaScript\n* [Plot.js](https://github.com/foo123/Plot.js) simple and small library which can plot graphs of functions and various simple charts and can render to Canvas, SVG and plain HTML\n* [MOD3](https://github.com/foo123/MOD3) 3D Modifier Library in JavaScript\n* [HAAR.js](https://github.com/foo123/HAAR.js) image feature detection based on Haar Cascades in JavaScript (Viola-Jones-Lienhart et al Algorithm)\n* [HAARPHP](https://github.com/foo123/HAARPHP) image feature detection based on Haar Cascades in PHP (Viola-Jones-Lienhart et al Algorithm)\n* [FILTER.js](https://github.com/foo123/FILTER.js) video and image processing and computer vision Library in pure JavaScript (browser and node)\n* [css-color](https://github.com/foo123/css-color) simple class to parse and manipulate colors in various formats\n* [img2svg](https://github.com/foo123/img2svg) vectorize image data to svg\n* [svg2json](https://github.com/foo123/svg2json) parse svg to json\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoo123%2Fsvg2json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffoo123%2Fsvg2json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoo123%2Fsvg2json/lists"}