Answers for "how to check if json object value in php"

PHP
2

php check if json

function isJson($string) {
 json_decode($string);
 return (json_last_error() == JSON_ERROR_NONE);
}
Posted by: Guest on April-09-2020
1

php if is json object

//Simple
if (is_object(json_decode($var))) { 
  ....
}

//Else
var $x = json_decode($var);
var $y = is_object($x)?$x:....;

//Better
function json_validate($string) {
    // decode the JSON data
    $
Posted by: Guest on March-30-2020

Code answers related to "how to check if json object value in php"

Browse Popular Code Answers by Language