Created
March 23, 2015 10:33
-
-
Save umanda/ad4116af41540c6e72d7 to your computer and use it in GitHub Desktop.
Validate JSON String in PHP
This file contains hidden or 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
/** | |
* Validate JSON String | |
* @param String $json | |
* @return boolean | |
*/ | |
protected function isValidJson($json) { | |
json_decode($json); | |
return (json_last_error() == JSON_ERROR_NONE); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment