Learn R Programming

rjsoncons (version 1.3.1)

j_schema_is_valid: Validate JSON documents against JSON Schema

Description

j_schema_is_vaild() uses JSON Schema https://json-schema.org/ to validate JSON 'data' according to 'schema'.

j_schema_validate() returns a JSON or R object, data.frame, or tibble, describing how data does not conform to schema. See the "Using 'jsoncons' in R" vignette for help interpreting validation results.

Usage

j_schema_is_valid(
  data,
  schema,
  ...,
  data_type = j_data_type(data),
  schema_type = j_data_type(schema)
)

j_schema_validate( data, schema, as = "string", ..., data_type = j_data_type(data), schema_type = j_data_type(schema) )

Arguments

data

JSON character vector, file, or URL defining document to be validated. NDJSON data and schema are not supported.

schema

JSON character vector, file, or URL defining the schema against which data will be validated.

...

passed to jsonlite::toJSON when data is not character-valued.

data_type

character(1) type of data; one of "json" or a value returned by j_data_type(); schema validation does not support "ndjson" data.

schema_type

character(1) type of schema; see data_type.

as

for j_schema_validate(), one of "string", "R", "data.frame", "tibble", or "details", to determine the representation of the return value.