Skip to content
Snippets Groups Projects
Commit 43672ac1 authored by Tom Robinson's avatar Tom Robinson
Browse files

Fix: Object detail doesn't format JSON fields as JSON

parent c7b5a4db
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@ import Icon from 'metabase/components/Icon.jsx';
import IconBorder from 'metabase/components/IconBorder.jsx';
import LoadingSpinner from 'metabase/components/LoadingSpinner.jsx';
import { foreignKeyCountsByOriginTable } from 'metabase/lib/schema_metadata';
import { isPK } from "metabase/lib/types";
import { TYPE, isa, isPK } from "metabase/lib/types";
import { singularize, inflect } from 'inflection';
import cx from "classnames";
......@@ -67,7 +67,7 @@ export default class QueryVisualizationObjectDetailTable extends Component {
var cellValue;
if (row[1] === null || row[1] === undefined || (typeof row[1] === "string" && row[1].length === 0)) {
cellValue = (<span className="text-grey-2">Empty</span>);
} else if(row[0].special_type === "json") {
} else if (isa(row[0].special_type, TYPE.SerializedJSON)) {
let formattedJson = JSON.stringify(JSON.parse(row[1]), null, 2);
cellValue = (<pre className="ObjectJSON">{formattedJson}</pre>);
} else if (typeof row[1] === "object") {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment