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

Stringify objects in object detail, e.x. MongoDB nested objects

parent 28f35a88
Branches
Tags
No related merge requests found
......@@ -51,13 +51,14 @@ export default class QueryVisualizationObjectDetailTable extends Component {
} else {
var cellValue;
if (row[1] === null || (typeof row[1] === "string" && row[1].length === 0)) {
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") {
var formattedJson = JSON.stringify(JSON.parse(row[1]), null, 2);
cellValue = (<pre className="ObjectJSON">{formattedJson}</pre>);
} else if (typeof row[1] === "object") {
var formattedJson = JSON.stringify(row[1], null, 2);
cellValue = (<pre className="ObjectJSON">{formattedJson}</pre>);
} else {
// TODO: should we be casting all values toString()?
cellValue = (<ExpandableString str={row[1].toString()} length={140}></ExpandableString>);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment