diff --git a/demo/validate_api.php b/demo/validate_api.php index 3c46cc7..f06e123 100644 --- a/demo/validate_api.php +++ b/demo/validate_api.php @@ -105,7 +105,7 @@ function print_result($response) $response->debug(); } if ($showJson) { - $json = $response->getJson(); + $json = json_decode($response->getJsonString()); if ($json !== null) { print("\n"); print(json_encode($json, JSON_PRETTY_PRINT)); diff --git a/public/api.php b/public/api.php index db47b58..a579518 100644 --- a/public/api.php +++ b/public/api.php @@ -130,8 +130,8 @@ function logApiSuccess(string $url, object $response, array $context = []): void } $file = null; -if ($response && method_exists($response, 'getJson')) { - $json_file = json_encode($response->getJson()); +if ($response instanceof \ubfr\c5tools\interfaces\JsonDocument) { + $json_file = $response->getJsonString(); if ($json_file) { $compressed = gzcompress($json_file, 3); if ($compressed) {