Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php try json decode and check

// Checks if json
function isJson($string) {
   json_decode($string);
   return json_last_error() === JSON_ERROR_NONE;
}

// example
if (isJson($string) {
  // Do your stuff here
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #json #decode #check
ADD COMMENT
Topic
Name
2+4 =