+1 vote
9.2k 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 1.9k views
0 votes
1 answer 2.5k views
0 votes
1 answer 6.9k views
0 votes
1 answer 421 views
asked Jul 29, 2016 in Phalcon by Robin
0 votes
1 answer 7.4k views
...