Skip to content

Commit 9d0d488

Browse files
committed
Handle JSON with trailing semicolon
1 parent 48bf38f commit 9d0d488

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/parsers/jsonld-parser.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ export default function (html, config = {}) {
77

88
$html('script[type="application/ld+json"]').each((index, item) => {
99
try {
10-
let parsedJSON = JSON.parse($(item).text())
10+
const json = item.children[0].data.replace(/;$/, '')
11+
let parsedJSON = JSON.parse(json)
1112
if (!Array.isArray(parsedJSON)) {
1213
parsedJSON = [parsedJSON]
1314
}

0 commit comments

Comments
 (0)