javascript check if is json code example
Example 1: if json valide js
function IsJsonString(str) {
try {
JSON.parse(str);
} catch (e) {
return false;
}
return true;
}
Example 2: javascript json trypass
Uncaught SyntaxError: Unexpected token c in JSON at position 1