diff --git a/packages/grafana-ui/src/components/Table/JSONViewCell.tsx b/packages/grafana-ui/src/components/Table/JSONViewCell.tsx index b642be28efc..7784f540413 100644 --- a/packages/grafana-ui/src/components/Table/JSONViewCell.tsx +++ b/packages/grafana-ui/src/components/Table/JSONViewCell.tsx @@ -3,6 +3,7 @@ import { css, cx } from 'emotion'; import { TableCellProps } from './types'; import { Tooltip } from '../Tooltip/Tooltip'; import { JSONFormatter } from '../JSONFormatter/JSONFormatter'; +import { isString } from 'lodash'; export const JSONViewCell: FC = props => { const { field, cell, tableStyles } = props; @@ -16,8 +17,16 @@ export const JSONViewCell: FC = props => { font-family: monospace; `; - const displayValue = JSON.stringify(cell.value); - const content = ; + let value = cell.value; + let displayValue = value; + if (isString(value)) { + try { + value = JSON.parse(value); + } catch {} // ignore errors + } else { + displayValue = JSON.stringify(value); + } + const content = ; return (