Description Usage Arguments Details Examples
Pass in a plaintext JSON or an R list
to see formatted JSON in a viewer.
1 2 |
x |
plaintext JSON or an R |
auto_unbox |
passed to |
scroll |
should the |
elementId |
element id |
width |
widget width (best to keep it at 100%) |
height |
widget height (kinda only useful for knitting since this is meant to be an interactive tool). |
It uses the jsonlite
package to deal with gnarly lists (h/t @jennybryan).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | library(jsonlite)
# available styles
highlight_styles()
# plain character
txt <- '{
"glossary": {
"title": "example glossary",
"GlossDiv": {
"title": "S",
"GlossList": {
"GlossEntry": {
"ID": "SGML",
"SortAs": "SGML",
"GlossTerm": "Standard Generalized Markup Language",
"Acronym": "SGML",
"Abbrev": "ISO 8879:1986",
"GlossDef": {
"para": "A meta-markup language, used to create markup languages such as DocBook.",
"GlossSeeAlso": ["GML", "XML"]
},
"GlossSee": "markup"
}
}
}
}
}'
json_tree_view(txt)
doc <- fromJSON(txt)
json_tree_view(doc)
## Not run:
json_tree_view(readLines("https://collector.torproject.org/index.json",
warn=FALSE))
json_tree_view(fromJSON("https://collector.torproject.org/index.json",
simplifyVector=FALSE))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.