jsonedit: View 'Lists' with "jsoneditor"

Description Usage Arguments Examples

View source: R/jsonedit.R

Description

jsonedit provides a flexible and helpful interactive tree-like view of lists or really any R dataset that can be represented as JSON. Eventually, this could become a very nice way to not only view but also modify R data using Shiny.

Usage

1
2
jsonedit(listdata = NULL, mode = "tree", modes = c("code", "form", "text",
  "tree", "view"), ..., width = NULL, height = NULL, elementId = NULL)

Arguments

listdata

list or String data to view. Although designed for lists, listdata can be any data source that can be rendered into JSON with jsonlite. Alternately, listdata could be a String of valid JSON. This might be helpful when dealing with an API response.

mode

string for the initial view from modes. 'tree' is the default.

modes

string c('code', 'form', 'text', 'tree', 'view') will be the default, since these are all the modes currently supported by jsoneditor.

...

list of other options for jsoneditor. This is a temporary way of trying other options in jsoneditor. In the future, this will be eliminated in favor of specific, more self-documenting and helpful arguments.

width

integer in pixels defining the width of the div container.

height

integer in pixels defining the height of the div container.

elementId

character to specify valid CSS id of the htmlwidget for special situations in which you want a non-random identifier.

Examples

 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
   library(listviewer)

   # using the data from the jsoneditor simple example
   #  in R list form
   jsonedit(
     list(
       array = c(1,2,3)
       ,boolean = TRUE
       ,null = NULL
       ,number = 123
       ,object = list( a="b", c="d" )
       ,string = "Hello World"
     )
   )

   # jsonedit also works with a JSON string
   jsonedit(
     '{"array" : [1,2,3] , "boolean" : true, "null" : null, number = 123}'
   )

   # also works with most data.frames
   jsonedit( mtcars )

   # helpful interactive view of par
   jsonedit( par() )

listviewer documentation built on April 1, 2018, 12:23 p.m.