
Show HN: JsonTree, a tool for turning JSON data into a collapsible html tree - MaxLeiter
https://github.com/MaxLeiter/jsonTree
======
BillSaysThis
What about a variation where the JSON object is passed in directly and not
delivered via URL?

~~~
MaxLeiter
Never thought of that, good idea though. Do you recommend having the
jsonTree() function check if its a valid URL, or using a separate function?

~~~
BillSaysThis
You certainly could have a separate function since this would need to know
about the in-memory cache of the JSON versus pulling it from the URL.

Or you could also refactor the JSONTree function to (a) check if the first
param is an object or string and (b) put the meet of the request eventListener
(lines 24-35) into a separate function that's called as appropriate in each
case.

------
wingerlang
Add a live demo.

~~~
MaxLeiter
[http://maxleiter.github.io/jsonTree/example/](http://maxleiter.github.io/jsonTree/example/)

~~~
fundamental
Neat demo, though it doesn't work with the default url due to a https vs http
conflict in firefox. From the js console I see "Blocked loading mixed active
content" and changing the url to some content served over https (e.g. the
project's package.json) seems to work fine.

~~~
MaxLeiter
Thanks, fixed

