diff --git a/src/core/components/response.jsx b/src/core/components/response.jsx index e354c61e..227ce43a 100644 --- a/src/core/components/response.jsx +++ b/src/core/components/response.jsx @@ -5,14 +5,16 @@ import { getSampleSchema } from "core/utils" const getExampleComponent = ( sampleResponse, examples, HighlightCode ) => { if ( examples && examples.size ) { return examples.entrySeq().map( ([ key, example ]) => { - let exampleValue - try { - exampleValue = example && example.toJS ? example.toJS() : example - exampleValue = JSON.stringify(exampleValue, null, 2) - } - catch(e) { - exampleValue = String(example) + let exampleValue = example + if ( example.toJS ) { + try { + exampleValue = JSON.stringify(example.toJS(), null, 2) + } + catch(e) { + exampleValue = String(example) + } } + return (
{ key }