Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #object #json
ADD COMMENT
Topic
Name
6+9 =