src/Viserio/Component/Parser/Dumper/JsonDumper.php
public function dump(array $data): string
    {
        // Clear json_last_error()
        \json_encode(null);

        $json = \json_encode($data, $this->options, $this->depth);

        if (\json_last_error() !== \JSON_ERROR_NONE) {
            throw new DumpException(\sprintf('JSON dumping failed: %s.', \json_last_error_msg()));
        }

        $json = \preg_replace('/\[\s+\]/', '[]', $json);

        return \preg_replace('/\{\s+\}/', '{}', $json);
    }
public function dump(array $data): string
    {
        // Clear json_last_error()
        \json_encode(null);

        $json = \json_encode($data, $this->options, $this->depth);

        if (\json_last_error() !== \JSON_ERROR_NONE) {
            throw new DumpException(\sprintf('JSON dumping failed: %s.', \json_last_error_msg()));
        }

        $json = \preg_replace('/\[\s+\]/', '[]', $json);

        return \preg_replace('/\{\s+\}/', '{}', $json);
    }
{@inheritdoc}