Created
May 13, 2015 14:17
-
-
Save gluc/156f6bafc9913b989d14 to your computer and use it in GitHub Desktop.
Converting data.tree to JSON, simpler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#this has now become much simpler: | |
data(acme) | |
l <- acme$ToList() | |
#alternatively, you might prefer the "traditional" generic method: | |
l <- as.list(acme) | |
library(rjson) | |
j <- toJSON(l) | |
cat(j) | |
#as a side note: you can also convert a list to a Node: | |
a2 <- as.Node(l) |
This is wonderful. I really appreciate it. With my little listviewer
htmlwidget, you can do
#devtools::install_github("timelyportfolio/listviewer")
library(listviewer)
jsonedit(l)
and get a result like this
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See http://github.com/gluc/data.tree