Skip to contents

Converts an audit_trail() object to a plain R list suitable for serialisation with jsonlite::toJSON(). All POSIXct timestamps are converted to ISO 8601 character strings and data.frames are converted to lists of named rows for JSON compatibility.

Usage

trail_to_list(.trail)

Arguments

.trail

An audit_trail() object.

Value

A named list with elements name, created_at (ISO 8601 string), n_snapshots, and snapshots (a named list keyed by snapshot label).

See also

Examples

trail <- audit_trail("example")
mtcars |> audit_tap(trail, "raw")
lst <- trail_to_list(trail)
str(lst, max.level = 2)
#> List of 4
#>  $ name       : chr "example"
#>  $ created_at : chr "2026-03-24T12:14:34Z"
#>  $ n_snapshots: int 1
#>  $ snapshots  :List of 1
#>   ..$ raw:List of 15