how to check string is json or not code example
Example: check if the data can be parsed javascript
function isJson(str) {
try {
return JSON.parse(str);
} catch (e) {
return false;
}
}