JSON pretty printer & viewer in R
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
R
inst/htmlwidgets
man
.Rbuildignore
.gitignore
DESCRIPTION collapsable tree view Jan 23, 2016
LICENSE
NAMESPACE
README.Rmd
README.html
README.md
jsonview.Rproj
jsonview.png

README.md

jsonview : View formatted and "pretty printed" JSON or lists in R

(if you need XML viewing in R check out jsonview's sister package, xmlview)

It is intended for interactive use. When working with gnarly lists or JSON data, it's often times advantageous to be able to see the document in a more formatted way.

You can pass in:

  • plain character JSON
  • an R list object (any R object, really)

and view the formatted & pretty-printed result in the RStudio viewer or web browser.

Here's an example of the collapsable tree view generaged by:

json_tree_view(fromJSON("https://collector.torproject.org/index.json"))

The widget uses vkbeautify, highlight.js and jquery.json-treeview to do all the work.

The following functions are implemented:

  • json_view: view JSON, formatted & pretty-printed
  • json_tree_view: view JSON in a collapsable tree view

News

  • Version 0.2.0 : json_tree_view()
  • Version 0.1.0 released

Installation

devtools::install_github("hrbrmstr/jsonview")

Usage

library(xmlview)
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_view(txt)
json_tree_view(txt)

doc <- fromJSON(txt)
json_view(doc, style="obsidian")
json_tree_view(doc)

json_view(readLines("https://collector.torproject.org/index.json", warn=FALSE))

json_tree_view(readLines("https://collector.torproject.org/index.json", warn=FALSE))

json_tree_view(fromJSON("https://collector.torproject.org/index.json"))

json_view(fromJSON("https://collector.torproject.org/index.json",
                   simplifyVector=FALSE))