I am working with an SVG file and converting it to JSON using svgson
library. Additionally, I am using the svg-path-to-polygons
library to decode the d
attribute in the path element. However, I am encountering the following error:
peg$SyntaxError: Expected ",", ".", [ tnr], [+-], [0-9], [Aa], [Cc], [Hh], [Ll], [Mm], [Qq], [Ss], [Tt], [Vv], [Zz], [eE], or end of input but "&" found.
Here is a snippet of the SVG JSON data I am working with:
{
"name": "g",
"type": "element",
"value": "",
"attributes": {
"id": "nopointer-base"
},
"children": [
{
"name": "path",
"type": "element",
"value": "",
"attributes": {
"fill": "#F2F2F2",
"d": "M1737.5,678.8h-811c-11,0-20,9-20,20V1138h-137v291.5h184.1v245H1117v265.1h232.9l68.6-65.9l0.1-780.4
ttth75.9V932.5h232.4l30.6-31.8V698.8C1757.5,687.7,1748.5,678.8,1737.5,678.8z"
},
"children": []
}
]
}
Environment:
- Libraries:
svgson
,svg-path-to-polygons
Steps to Reproduce:
- Parse the SVG file to JSON using
svgson
. - Attempt to decode the
d
attribute usingsvg-path-to-polygons
.
Expected Behavior:
The d
attribute should be decoded without syntax errors.
Actual Behavior:
The following error is thrown: peg$SyntaxError: Expected ",", ".", [ tnr], [+-], [0-9], [Aa], [Cc], [Hh], [Ll], [Mm], [Qq], [Ss], [Tt], [Vv], [Zz], [eE], or end of input but "&" found.
Question:
How can I resolve this syntax error? Is there an issue with the format of the d
attribute string, or is there something I am missing in the usage of the svgson
or svg-path-to-polygons
libraries?
Any help or guidance would be appreciated.