colearendt / tidyjson

Tidy your JSON data in R with tidyjson
Other
183 stars 15 forks source link

Change spread_all to order nested columns in appearance in JSON #89

Closed jeremystan closed 8 years ago

jeremystan commented 8 years ago

Currently spread_all handles nested columns like this:

> '{"a": 1, "b": {"c": 2}, "d": 3}' %>% spread_all %>% names
[1] "document.id" "a"           "d"           "b.c"

Would prefer that the order is "a", "b.c", "d" instead

jeremystan commented 8 years ago

This order is very difficult to guarantee across multiple documents, e.g.,

how to guarantee they come out "a", "b", "c"?
c('{"a": 1, "c": 2}', '{"b": 1, "c": 3}') %>% spread_all

This is more complex when they are nested, so for now leaving this be.