public function matchSchema($json, $schema)
    {
        $validator = new Validator();

        if (is_string($json)) {
            $json = $this->decode($json, TRUE);
        } elseif (is_array($json)) {
            $json = (object) $json;
        }

        if (is_string($schema)) {
            $schema = $this->decode($schema, TRUE);
        } elseif (is_array($schema)) {
            $schema = (object) $schema;
        }

        $validator->check($json, $schema);
        $this->lastSchemaErrors = $validator->getErrors();

        return $validator->isValid();
    }