$(object).isJSON()

Tests a field value is a valid JSON string

Examples:
$("#somefield").isJSON()
// -> (true|false)


$.isJSON(object[string]), [String].isJSON()

Tests if a value is a valid JSON string

"something".isJSON()
// -> false
"\"something\"".isJSON()
// -> true
"{ foo: 42 }".isJSON()
// -> false
"{ \"foo\": 42 }".isJSON()
// -> true


testBed

Result: Not tested




Made by Victor G. (VictorG.Oliveira [at] live.co.uk)