Closed davidbomze closed 4 years ago
@davidbomze Thanks for the report! Would you mind trying this with the latest development version? The behavior was the same for me, but I believe this is because of the object type (an array
). Do we recommend this example in the docs or something somewhere? You might have a look at the following and see if this helps explain.
library(tidyjson)
#>
#> Attaching package: 'tidyjson'
#> The following object is masked from 'package:stats':
#>
#> filter
issues %>% json_types()
#> # A tbl_json: 1 x 2 tibble with a "JSON" attribute
#> `attr(., "JSON")` document.id type
#> <chr> <int> <fct>
#> 1 "[{\"url\":\"https:..." 1 array
issues %>% gather_array() %>% json_types()
#> # A tbl_json: 30 x 3 tibble with a "JSON" attribute
#> `attr(., "JSON")` document.id array.index type
#> <chr> <int> <int> <fct>
#> 1 "{\"url\":\"https:/..." 1 1 object
#> 2 "{\"url\":\"https:/..." 1 2 object
#> 3 "{\"url\":\"https:/..." 1 3 object
#> 4 "{\"url\":\"https:/..." 1 4 object
#> 5 "{\"url\":\"https:/..." 1 5 object
#> 6 "{\"url\":\"https:/..." 1 6 object
#> 7 "{\"url\":\"https:/..." 1 7 object
#> 8 "{\"url\":\"https:/..." 1 8 object
#> 9 "{\"url\":\"https:/..." 1 9 object
#> 10 "{\"url\":\"https:/..." 1 10 object
#> # ... with 20 more rows
issues %>% gather_array() %>% spread_all()
#> # A tbl_json: 30 x 86 tibble with a "JSON" attribute
#> `attr(., "JSON"… document.id array.index url labels_url comments_url
#> <chr> <int> <int> <chr> <chr> <chr>
#> 1 "{\"url\":\"htt… 1 1 http… https://a… https://api…
#> 2 "{\"url\":\"htt… 1 2 http… https://a… https://api…
#> 3 "{\"url\":\"htt… 1 3 http… https://a… https://api…
#> 4 "{\"url\":\"htt… 1 4 http… https://a… https://api…
#> 5 "{\"url\":\"htt… 1 5 http… https://a… https://api…
#> 6 "{\"url\":\"htt… 1 6 http… https://a… https://api…
#> 7 "{\"url\":\"htt… 1 7 http… https://a… https://api…
#> 8 "{\"url\":\"htt… 1 8 http… https://a… https://api…
#> 9 "{\"url\":\"htt… 1 9 http… https://a… https://api…
#> 10 "{\"url\":\"htt… 1 10 http… https://a… https://api…
#> # ... with 20 more rows, and 81 more variables: events_url <chr>,
#> # html_url <chr>, id <dbl>, number <dbl>, title <chr>, state <chr>,
#> # locked <lgl>, assignee <lgl>, milestone <lgl>, comments <dbl>,
#> # created_at <chr>, updated_at <chr>, closed_at <lgl>, body <chr>,
#> # user.login <chr>, user.id <dbl>, user.avatar_url <chr>,
#> # user.gravatar_id <chr>, user.url <chr>, user.html_url <chr>,
#> # user.followers_url <chr>, user.following_url <chr>,
#> # user.gists_url <chr>, user.starred_url <chr>,
#> # user.subscriptions_url <chr>, user.organizations_url <chr>,
#> # user.repos_url <chr>, user.events_url <chr>,
#> # user.received_events_url <chr>, user.type <chr>,
#> # user.site_admin <lgl>, assignee.login <chr>, assignee.id <dbl>,
#> # assignee.avatar_url <chr>, assignee.gravatar_id <chr>,
#> # assignee.url <chr>, assignee.html_url <chr>,
#> # assignee.followers_url <chr>, assignee.following_url <chr>,
#> # assignee.gists_url <chr>, assignee.starred_url <chr>,
#> # assignee.subscriptions_url <chr>, assignee.organizations_url <chr>,
#> # assignee.repos_url <chr>, assignee.events_url <chr>,
#> # assignee.received_events_url <chr>, assignee.type <chr>,
#> # assignee.site_admin <lgl>, milestone.url <chr>,
#> # milestone.labels_url <chr>, milestone.id <dbl>,
#> # milestone.number <dbl>, milestone.title <chr>,
#> # milestone.description <chr>, milestone.open_issues <dbl>,
#> # milestone.closed_issues <dbl>, milestone.state <chr>,
#> # milestone.created_at <chr>, milestone.updated_at <chr>,
#> # milestone.due_on <lgl>, pull_request.url <chr>,
#> # pull_request.html_url <chr>, pull_request.diff_url <chr>,
#> # pull_request.patch_url <chr>, milestone.creator.login <chr>,
#> # milestone.creator.id <dbl>, milestone.creator.avatar_url <chr>,
#> # milestone.creator.gravatar_id <chr>, milestone.creator.url <chr>,
#> # milestone.creator.html_url <chr>,
#> # milestone.creator.followers_url <chr>,
#> # milestone.creator.following_url <chr>,
#> # milestone.creator.gists_url <chr>,
#> # milestone.creator.starred_url <chr>,
#> # milestone.creator.subscriptions_url <chr>,
#> # milestone.creator.organizations_url <chr>,
#> # milestone.creator.repos_url <chr>, milestone.creator.events_url <chr>,
#> # milestone.creator.received_events_url <chr>,
#> # milestone.creator.type <chr>, milestone.creator.site_admin <lgl>
Created on 2019-03-13 by the reprex package (v0.2.1)
Seem to be getting this with latest tidyjson (0.2.1.9) and dplyr 0.5.0