fix: displaying json example when showObjectSchemaExamples enabled (#2635)

This commit is contained in:
Alex Varchuk 2025-01-08 17:49:11 +01:00 committed by GitHub
parent d614d2d022
commit 59ee73fefa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 // decode for better readability in examples: see https://github.com/Redocly/redoc/issues/1138
return decodeURIComponent(serializeParameterValue(field, example)); return decodeURIComponent(serializeParameterValue(field, example));
} else { } else {
return String(example); return typeof example === 'object' ? example : String(example);
} }
} }