The /enheter/lastned and /underenheter/lastned endpoints return
gzipped JSON arrays with nested objects. jsonlite::fromJSON(flatten = TRUE)
expands nested objects to dot-notation columns but leaves arrays as list
columns. The array is read in batches of complete objects
(read_json_objects()) and each batch parsed on its own, so the
whole decoded tree is never in memory at once; with a finite n_max
only the first n_max elements are read, which is how a sample of
the register is parsed. Every list column gets the tidy shape of the
live path (collapse_observed()):
Value
A tibble mapped via field_dict; arrays of objects are nested list-columns, everything else atomic.
Details
Character vectors (addresses, activities): line fragments of one value, joined with
"\n"Data frames (
paategninger,historiskeNavn): kept as a list-column of tibbles, one row per element,NULLwhere the entity has noneEmpty lists (HAL links): dropped
NULL elements:
NA_character_
Known columns are renamed via field_dict. Unknown columns pass through
with auto-generated snake_case names (zero-drop policy). The raw .gz
file is the provenance fallback for anyone needing the original nesting.