+1 vote
10.3k views
in Jquery by
How to verify json string (if valid) with jquery?

1 Answer

0 votes
by
Us this to verify.

function isJSON(str) 
{
    if( typeof( str ) !== 'string' ) { 
        return false;
    }
    try {
        JSON.parse(str);
        return true;
    } catch (e) {
        return false;
    }
}

Related questions

+1 vote
1 answer 3.8k views
0 votes
1 answer 4.0k views
0 votes
1 answer 16.9k views
0 votes
1 answer 1.8k views
0 votes
1 answer 1.3k views
asked Jul 29, 2016 in Phalcon by Robin
...