isJSON
1.5.1.1

isJSON() -> boolean

Check if the string is valid JSON by the use of regular expressions. This security method is called internally.

Examples


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