Specification: Core | Import | Alternate Names | Symbols, Units, Currencies | Validation | Conditional Composition

JSON Structure

Logo

JSON Structure is a data structure definition language that enforces strict typing, modularity, and determinism.

View the Project on GitHub json-structure

R SDK

The official JSON Structure SDK for R. It binds the native JSON Structure C engine through a small compiled shim, so validation runs in native code while the API stays idiomatic R.

Installation

The package is not on CRAN (it downloads a prebuilt native library at first use, which CRAN policy does not allow). Install from GitHub:

# install.packages("remotes")
remotes::install_github("json-structure/sdk", subdir = "r")

On first validation the package downloads a prebuilt json_structure shared library for your platform from the project’s GitHub Releases and caches it. To use a locally built library instead, set the JSONSTRUCTURE_LIB_PATH environment variable to its full path.

Usage

library(jsonstructure)

# Validate a schema (accepts a JSON string or an R list)
schema <- list(
  "$schema" = "https://json-structure.org/meta/core/v0/#",
  name = "Person",
  type = "object",
  properties = list(
    name = list(type = "string"),
    age  = list(type = "int32")
  )
)
schema_result <- js_validate_schema(schema)
is_valid(schema_result)                 # TRUE

# Validate an instance against a schema
instance_result <- js_validate_instance(list(name = "Alice", age = 30L), schema)
is_valid(instance_result)               # TRUE

# Inspect problems
bad <- js_validate_instance('123', '{"type": "string"}')
is_valid(bad)                           # FALSE
js_error_messages(bad)
as.data.frame(bad)                      # code / severity / message / path / line ...

Features

Documentation

See the README for full documentation, including development setup and the JSONSTRUCTURE_LIB_PATH override.