% 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{
\dontrun{
schema <- pedon_json_schema()
names(schema)
#> [1] "$schema"     "$id"         "title"       "type"        "required"   "properties"

# Validate a JSON profile against the schema:
if (requireNamespace("jsonvalidate", quietly = TRUE)) {
  schema_json <- pedon_json_schema(as = "json")
  jsonvalidate::json_validate('{"site":{...},"horizons":[...]}',
                                 schema_json, engine = "ajv")
}
}
}
