Files
30-seconds-of-code/snippets/isValidJSON.md
2017-12-31 18:23:01 +05:30

200 B

isValidJSON

Checks if the provided argument is an valid JSON.

const arr = (obj) => {
  try{
    JSON.parse(obj);
    return true;
  }
  catch(e){
    return false;
  }
}