Answers for "jason php"

PHP
8

php is json string

function IsJsonString(str) {
    try {
        JSON.parse(str);
    } catch (e) {
        return false;
    }
    return true;
}
Posted by: Guest on April-10-2020
0

php object to json

function getJsonData(){
    $var = get_object_vars($this);
    foreach ($var as &$value) {
        if (is_object($value) && method_exists($value,'getJsonData')) {
            $value = $value->getJsonData();
        }
    }
    return $var;
}
Posted by: Guest on July-04-2021

Browse Popular Code Answers by Language