diff --git a/x-pack/legacy/plugins/painless_playground/public/lib/helpers.ts b/x-pack/legacy/plugins/painless_playground/public/lib/helpers.ts index a6ab9a90500cc..af288ea53b275 100644 --- a/x-pack/legacy/plugins/painless_playground/public/lib/helpers.ts +++ b/x-pack/legacy/plugins/painless_playground/public/lib/helpers.ts @@ -72,8 +72,8 @@ export function formatJson(json: unknown): string { } export function formatResponse(response: Response): string { - if (response.result) { - return response.result; + if (typeof response.result === 'string') { + return response.result.replace(/\\n/g, '\n'); } else if (response.error) { return formatExecutionError(response.error); }