private function outputJson($value, $token)
    {
        $encoded = json_encode($value, $this->options);
        $error = json_last_error();

        if ($error !== JSON_ERROR_NONE) {
            $this->addError(sprintf('%s (%s)', json_last_error_msg(), $this->getJsonErrorName($error)));
        }

        $this->output($encoded, $token);
    }