form_to_json {preregr}R Documentation

Convert a (pre)registration specification to YAML or JSON

Description

Convert a (pre)registration specification to YAML or JSON

Usage

form_to_json(x, file = NULL)

prereg_spec_to_json(x, includeFormSpec = TRUE, file = NULL)

## S3 method for class 'preregr_json'
print(x, ...)

prereg_spec_to_yaml(x, includeFormSpec = TRUE, file = NULL)

## S3 method for class 'preregr_yaml'
print(x, ...)

Arguments

x

The (pre)registration object (as produced by a call to prereg_initialize()), or, for the print method, the produced YAML or JSON.

file

Optionally, a file to save the YAML or JSON to.

includeFormSpec

Whether to include the (pre)registration form specification. Note that this includes metadata about the form fields such as their labels and descriptions - without the form specification, only the item identifiers are stored.

...

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 YAML/JSON will be returned as a character vector.

Examples

### Load an example (pre)registration specification
data("examplePrereg_1", package = "preregr");

### Export to YAML
preregr::prereg_spec_to_json(
  examplePrereg_1
);
### Load an example (pre)registration specification
data("examplePrereg_1", package = "preregr");

### Export to YAML
preregr::prereg_spec_to_yaml(
  examplePrereg_1
);

[Package preregr version 0.2.9 Index]