% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/json-schema.R
\name{pedon_json_schema}
\alias{pedon_json_schema}
\title{JSON Schema for a soilKey PedonRecord}
\usage{
pedon_json_schema(as = c("list", "json"), pretty = TRUE)
}
\arguments{
\item{as}{One of \code{"list"} (default; returns a structured R list
ready to serialise) or \code{"json"} (returns a JSON string;
requires the \code{jsonlite} package).}

\item{pretty}{Logical, only used for \code{as = "json"}.}
}
\value{
A list (default) or a JSON string.
}
\description{
Returns a Draft-2020-12 JSON Schema describing the canonical
\code{PedonRecord} structure: a \code{site} object with site-level
metadata plus a \code{horizons} array where each element matches
the canonical horizon schema documented by
\code{\link{horizon_column_spec}}.
}
\examples{
schema <- pedon_json_schema()
names(schema)

\donttest{
# Validate a JSON profile against the schema:
if (requireNamespace("jsonvalidate", quietly = TRUE) &&
      requireNamespace("jsonlite", quietly = TRUE)) {
  schema_json <- pedon_json_schema(as = "json")
  p <- make_ferralsol_canonical()
  p_json <- jsonlite::toJSON(list(site = p$site,
                                    horizons = list()),
                                auto_unbox = TRUE, null = "null")
  jsonvalidate::json_validate(p_json, schema_json, engine = "ajv")
}
}
}
