Check whether it is a valid JSON string.
Usage:
const ret1 = isJSONString(`['a', 'b', 'c']`);const ret2 = isJSONString(`["a", "b", "c"]`);console.log(ret1);console.log(ret2); Copy
const ret1 = isJSONString(`['a', 'b', 'c']`);const ret2 = isJSONString(`["a", "b", "c"]`);console.log(ret1);console.log(ret2);
Output:
false true Copy
false true
The string to check.
Return the result of checking.
Check whether it is a valid JSON string.
Usage:
Output: