hrbrmstr / jsonview

JSON pretty printer & viewer in R
Other
30 stars 7 forks source link

Displaying json tree view in Shiny? #4

Open iainmwallace opened 7 years ago

iainmwallace commented 7 years ago

Hi,

First of great package!

A small question if I may, Is it possible to display the interactive json_tree_view in Shiny?

This is a basic single file shiny app that is causing the error "Error : package ‘jsontreeview’ not found" when I use "jsontreeviewOutput"

` library(jsonview) library(shiny) library(httr)

ui <- fluidPage(

sidebarLayout( sidebarPanel( actionButton("go","get info") ),

  mainPanel(
    jsonviewOutput("my_info")
    ,jsontreeviewOutput("my_tree_info")  ## this line causes an error

  )

) )

server <- function(input, output) {

my_details <- eventReactive(input$go, { my_url<-"https://api.github.com/users/hadley/orgs" z<-GET(my_url) x<-content(z,as="parsed") txt<-toJSON(x) return(txt) })

output$my_info <- renderJsonview({

 json_view(my_details())

 })

output$my_tree_info <- renderJsontreeview({

 json_tree_view(my_details())

}) }

Run the application

shinyApp(ui = ui, server = server)

`

Thanks again,

Iain

hrbrmstr commented 7 years ago

perhaps give https://github.com/timelyportfolio/listviewer a go? while i still use this pkg interactively on my own, @timelyportfolio's is far more polished.

iainmwallace commented 7 years ago

Thanks for the suggestion - just tried it and it works great.

Sent from my iPhone

On Apr 22, 2017, at 20:54, Боб Рудіс notifications@github.com wrote:

perhaps give https://github.com/timelyportfolio/listviewer a go? while i still use this pkg interactively on my own, @timelyportfolio's is far more polished.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.