How to check if a json string is valid or not in JavaScript or Jquery?
<p>Have tried :</p>

<pre><code>function isJSON(str) {
    try {
        JSON.parse(str);
    } catch (e) {
        return false;
    }
    return true;
}
</code></pre>

<p>To check weather a string is json or not. It returns true for boolean type formats.</p>

<p>Is there any possible way to identify a valid json string in Java Script or in JQuery?</p>