Update isValidJSON.md
This commit is contained in:
@ -8,8 +8,10 @@ Use `JSON.parse()` and a `try... catch` block to check if the provided argument
|
||||
const isValidJSON = obj => {
|
||||
try {
|
||||
JSON.parse(obj);
|
||||
if (o && typeof o === "object") {
|
||||
return true;
|
||||
} catch (e) {
|
||||
}
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user