We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bbe2fc0 commit d7c18c9Copy full SHA for d7c18c9
packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/Body/index.tsx
@@ -233,9 +233,18 @@ function Body({
233
}
234
if (examples) {
235
for (const [key, example] of Object.entries(examples)) {
236
+ let body = example.value;
237
+ try {
238
+ // If the value is already valid JSON we shouldn't double encode the value
239
+ JSON.parse(example.value);
240
+ }
241
+ catch (e) {
242
+ body = JSON.stringify(example.value, null, 2);
243
244
+
245
examplesBodies.push({
246
label: key,
- body: JSON.stringify(example.value, null, 2),
247
+ body,
248
summary: example.summary,
249
});
250
0 commit comments