Skip to contents

tower_to_json() writes a programme as a versioned JSON document: every stage and layer with all its terms, numbers bit for bit. tower_from_json() reads it back to an equal tower, rebuilding each layer through the same checks as xol_layer(), so a document with an impossible term is refused.

Usage

tower_to_json(tower)

tower_from_json(text)

Arguments

tower

A reinsurance_tower.

text

A document written by tower_to_json().

Value

tower_to_json(): a single string. tower_from_json(): a reinsurance_tower.

Examples

tw <- inuring_tower(list(list(surplus_treaty("S", 1e6, 4)),
                         list(xol_layer("XL", 2e6, 1e6))))
text <- tower_to_json(tw)
identical(tower_to_json(tower_from_json(text)), text)
#> [1] TRUE