Skip to content

Instantly share code, notes, and snippets.

@umanda
Created March 23, 2015 10:33
Show Gist options
  • Save umanda/ad4116af41540c6e72d7 to your computer and use it in GitHub Desktop.
Save umanda/ad4116af41540c6e72d7 to your computer and use it in GitHub Desktop.
Validate JSON String in PHP
/**
* 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