Skip to content

handling of NA and null in json_unnest_longer/wider() #37

@mgirlich

Description

@mgirlich

in json_flatten() it makes sense to drop NA, json nulls, empty arrays and nulls in arrays as one cannot know where they came from -> they are useless.

  • should NA, json nulls, empty arrays and nulls in arrays all be treated the same?
  • sometimes it might make sense to keep them
  • tidyr::unnest_longer() keeps them
tidyr::unnest_longer(
  tibble::tibble(
    id = 1:2,
    l = list(NULL, c(3, 5, 9))
  ),
  l
)
#> # A tibble: 4 x 2
#>      id     l
#>   <int> <dbl>
#> 1     1    NA
#> 2     2     3
#> 3     2     5
#> 4     2     9
  • add argument how to handle?

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions