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

1 Answer

0 votes
answered 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 471 views
0 votes
1 answer 1k views
0 votes
1 answer 1.9k views
0 votes
1 answer 322 views
asked Jul 29, 2016 in Phalcon by Robin
0 votes
1 answer 6k views
...