Skip to content

Commit

Permalink
Handle another common invalid JSON case
Browse files Browse the repository at this point in the history
  • Loading branch information
grahambates committed Dec 17, 2018
1 parent 90be83d commit 27fc6f6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/parsers/jsonld-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function (html, config = {}) {

$html('script[type="application/ld+json"]').each((index, item) => {
try {
const json = item.children[0].data.trim().replace(/[\r\n]/g, ' ').replace(/;$/, '')
const json = item.children[0].data.trim().replace(/\\ /g, ' ').replace(/[\r\n]/g, ' ').replace(/;$/, '')
let parsedJSON = JSON.parse(json)
if (!Array.isArray(parsedJSON)) {
parsedJSON = [parsedJSON]
Expand Down

0 comments on commit 27fc6f6

Please sign in to comment.