From 59ee73fefa8e8edb398940076bdd721fc284caa3 Mon Sep 17 00:00:00 2001 From: Alex Varchuk Date: Wed, 8 Jan 2025 17:49:11 +0100 Subject: [PATCH] fix: displaying json example when showObjectSchemaExamples enabled (#2635) --- src/utils/openapi.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/openapi.ts b/src/utils/openapi.ts index 33e0193a..1d3a33c5 100644 --- a/src/utils/openapi.ts +++ b/src/utils/openapi.ts @@ -393,7 +393,7 @@ export function getSerializedValue(field: FieldModel, example: any) { // decode for better readability in examples: see https://github.com/Redocly/redoc/issues/1138 return decodeURIComponent(serializeParameterValue(field, example)); } else { - return String(example); + return typeof example === 'object' ? example : String(example); } }