Skip to content
This repository has been archived by the owner on May 10, 2022. It is now read-only.

Latest commit

 

History

History
156 lines (116 loc) · 5.71 KB

README-NOT.md

File metadata and controls

156 lines (116 loc) · 5.71 KB

README

Survey of JSON Affiliated R Packages

Need a package to help parse or explore the organization of keys within JSON that might be messy, complex, large, or unknown

Conversion/Processing

API Consumer

Schema Validation

Configuration Files

GeoJSON

Mapping

Helpers

Other

package JSOmetaN

  • Available at sctyner/JSOmetaN
  • provides high level meta data for JSON
  • useful if you're not sure what the object structure is
  • uses two functions: fetch and dig
  • iteratively give information about nested key value relationships

fetch

provides meta information:

  • key names
  • number of documents with those keys
  • whether the key is terminal or contains further nested structure

dig

subsets the data by a specific keyname, dropping down a level in organization


devtools::install_github("sctyner/JSOmetaN")
library(jsonlite)
library(JSOmetaN)
data1 <- fromJSON("https://api.github.com/users/hadley/repos")
data1 %>% fetch() %>% dig("owner") %>% fetch()
## # A tibble: 69 x 5
##            Key Doc.count      Class Obj.len Is.terminal
##          <chr>     <dbl>      <chr>   <dbl>       <lgl>
##  1          id        30    integer       1        TRUE
##  2        name        30  character       1        TRUE
##  3   full_name        30  character       1        TRUE
##  4       owner        30 data.frame      17       FALSE
##  5     private        30    logical       1        TRUE
##  6    html_url        30  character       1        TRUE
##  7 description        27  character       1        TRUE
##  8        fork        30    logical       1        TRUE
##  9         url        30  character       1        TRUE
## 10   forks_url        30  character       1        TRUE
## # ... with 59 more rows
## # A tibble: 17 x 5
##                    Key Doc.count     Class Obj.len Is.terminal
##                  <chr>     <dbl>     <chr>   <dbl>       <lgl>
##  1               login        30 character       1        TRUE
##  2                  id        30   integer       1        TRUE
##  3          avatar_url        30 character       1        TRUE
##  4         gravatar_id        30 character       1        TRUE
##  5                 url        30 character       1        TRUE
##  6            html_url        30 character       1        TRUE
##  7       followers_url        30 character       1        TRUE
##  8       following_url        30 character       1        TRUE
##  9           gists_url        30 character       1        TRUE
## 10         starred_url        30 character       1        TRUE
## 11   subscriptions_url        30 character       1        TRUE
## 12   organizations_url        30 character       1        TRUE
## 13           repos_url        30 character       1        TRUE
## 14          events_url        30 character       1        TRUE
## 15 received_events_url        30 character       1        TRUE
## 16                type        30 character       1        TRUE
## 17          site_admin        30   logical       1        TRUE

Shiny App: exploRing JSON

  • App for exploring JSON array data
  • Can upload a file in .json format
  • Or, can provide a query to an API

Functionality right now

  1. First, upload/query your JSON array data
  2. Explore it with listviewer
  3. View the structure of the data as a node-link diagram (code for plot taken from here)

Appearance

Uploading file

Using listviewer::jsonedit()

View data as node-link diagram