Published
- 1 min read
if json then parse
The solution for this is noted below
if json then parse
Solution
function isJson(str) {
try {
let value = JSON.parse(str)
return value
} catch (e) {
return str
}
}
Try other methods by searching on the site. That is if this doesn’t work