My class implements the
jsonSerialize in php
Then my class implements the jsonSerialize method and returns get_object_vars($this).
public function JsonSerialize()
{
$vars = get_object_vars($this);
return $vars;
}
The problem with this is it returns all the values including NULL variables too. How can I only get the non-null variables as json-output?