Skip to content

Instantly share code, notes, and snippets.

@alordiel
Created May 25, 2017 06:01
Show Gist options
  • Save alordiel/5fd5412db0cc0f65cc1776fb92494b2f to your computer and use it in GitHub Desktop.
Save alordiel/5fd5412db0cc0f65cc1776fb92494b2f to your computer and use it in GitHub Desktop.
Short JS function for checking if a string is JSON ready
function IsJsonString(str) {
try {
JSON.parse(str);
} catch (e) {
return false;
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment