Created
May 25, 2017 06:01
-
-
Save alordiel/5fd5412db0cc0f65cc1776fb92494b2f to your computer and use it in GitHub Desktop.
Short JS function for checking if a string is JSON ready
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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