JSON.parse throws an error when the text is not valid JSON. What does the console show?
try {
JSON.parse("oops")
console.log("parsed")
} catch (error) {
console.log("failed")
}