export_to_json {justifier} | R Documentation |
Export a justifier specification to JSON
Description
Export a justifier specification to JSON
Usage
export_to_json(x, file = NULL, wrap_in_html = FALSE)
## S3 method for class 'justifierStructuredObject'
export_to_json(x, file = NULL, wrap_in_html = FALSE)
## S3 method for class 'justifier_json'
print(x, ...)
Arguments
x |
The justifier specification. |
file |
Optionally, a file to save the JSON to. |
wrap_in_html |
Whether to wrap the JSON in an HTML element. |
... |
Any additional arguments are ignored. |
Value
If a file is specified to write, to, x
will be returned invisibly
to allow building a pipe chain; if file=NULL
, the resulting JSON
will be returned as a character vector.
Examples
### Programmatically create a justification with two assertions
### but without sources; flatten it; and show the json
justifier::justify(
"Icecream will make me feel less fit",
assertion = c(
justifier::assert('Icecream is rich in energy'),
justifier::assert('Consuming high-energy foods makes me feel less fit')
),
weight = -.5
) |>
justifier::flatten() |>
justifier::export_to_json();
[Package justifier version 0.2.6 Index]