View source: R/export_to_json.R
export_to_json | R Documentation |
Export a justifier specification to JSON
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, ...)
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. |
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.
### 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();
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.