react-json-inspector
react-json-inspector copied to clipboard
[Feature Request] add option to hide root node
Root node is something artificial/virtual in JSON documents, it would be nice to be able to hide it.
It's been some time, but I would like to propose a CSS solution, there's a modifier on the root leaf element, check for json-inspector__leaf_root. Does that sound like a plausible solution?
I think CSS solution would be enough for this feature.
Such solution is hackish, because requires to attach external CSS to React component (and use implementation details: json-inspector__leaf_root), but this feature is in some way hakish too: it will work only if root object is object or list, and it doesn't make sense for other types of root object.
Perhaps you can document how this feature can be resolved using CSS, e.g. provide example in docs? (I believe in addition to hiding root node label, subelements indentation should be removed)
+1 also interested in doing this in a cleaner way
this css will hide the first root and colon. verified it woks on objects and arrays.
.json-inspector > .json-inspector__leaf_root > .json-inspector__line > .json-inspector__key {
display: none;
}
We are already hiding it using CSS but I agree on that it would be great to have it as an option.