Check if is JSON Data

0.61K views
no comments
7 Sep 2014 10:30 am

The #json data tome times thrown an error on console when it get null data instead json data, so here is the best way to check if your data is #json then use it.

function isJSON(json_obj){
    try{
        JSON.parse(json_obj);
    } catch(e){
        return false;
    }
    return true;
}

NOTE:Your Email Address will be not shown and please do not add spamming comments because here is REL="NOFOLLOW" on your links and comments also moderated shown.
<code>Put html css or any language code under this tag</code>