Skip to content
This repository has been archived by the owner on May 14, 2020. It is now read-only.

Allow any root node? #5

Closed
EvanSimpson opened this issue Sep 7, 2015 · 2 comments
Closed

Allow any root node? #5

EvanSimpson opened this issue Sep 7, 2015 · 2 comments

Comments

@EvanSimpson
Copy link
Contributor

Right now the library only allows the root node to be an object or an array node, and any other value renders empty. Is this intentional, or would it be helpful to be able to display any value as the root node (surely at the very least adding capability for a JSONIterableNode as root)?

@EvanSimpson
Copy link
Contributor Author

I managed to implement this with a small modification to grab-node.js and then using that to pick the root node in index.js on this branch.

Happy to open a PR if this is desirable to others.

@chibicode
Copy link
Contributor

@EvanSimpson Hi Evan, thank you for pointing this out! I tracked it down to the original source code on Bitbucket: https://bitbucket.org/davevedder/react-json-viewer/commits/8b168f18ffd5bb53882793038a4994eeafe40b0f#Lsrc/jsx/jsonViewer.jsxT331 and this hasn't changed since. I don't see a downside in allowing any root node - reusing grab-node.js seems like a reasonable thing to do.

I just pulled in your changes :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants