public static function jsonEncode($object, $filter = null, $nullFilter = null)
    {
        if (!empty($filter) || !empty($nullFilter)) {
            $object = clone $object;
            $vars = get_object_vars($object);

            if (!empty ($filter)) {
                foreach ($filter as $prop) {
                    if (array_key_exists($prop, $vars)) {
                        unset($object->{$prop});
                    }
                }
            }

            if (!empty ($nullFilter)) {
                foreach ($nullFilter as $prop) {
                    if (array_key_exists($prop, $vars) && $vars[$prop] === null) {
                        unset($object->{$prop});
                    }
                }
            }
        }

        return json_encode($object);
    }