Javascript Object isJSON()

Description

Javascript Object isJSON()

Object.prototype.isJSON = function () {
    try {//from ww  w . j av  a2s.c o  m
        JSON.parse(this);
        return true;
    } catch (e) {
        return false;
    }
}



PreviousNext

Related