Skip to contents

Serializes a manifest to a pretty-printed JSON file with the native JSON codec ( bricklayer_json_to_json()) ; no jsonlite needed.

Usage

write_manifest_json(manifest, path, canonical = FALSE)

Arguments

manifest

A manifest as returned by make_manifest() / built up with record().

path

Destination path for the JSON file.

canonical

Write the canonical form rather than the pretty-printed one: one line, keys sorted, which is what manifest_digest() hashes. Use it when the file itself has to be byte-stable rather than read by a person.

Value

The path, returned invisibly.

Examples

man <- make_manifest(list(project = "demo"), environment = FALSE)
man <- record(man, "row_count", observed = 20, expected = 20)
#>   row_count                                    observed = 20.0000      expected = 20.0000      [PASS]
path <- write_manifest_json(man, tempfile(fileext = ".json"))
file.exists(path)
#> [1] TRUE

# Round-trips back through the package's own codec.
back <- bricklayer_json_from_json(path, simplifyVector = FALSE)
back$results$row_count$status        # "PASS"
#> [1] "PASS"