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

JSON Structure

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

JSON Structure is a schema language that can describe data types and structures whose definitions map cleanly to programming language types and database constructs as well as to the popular JSON data encoding. The type model reflects the needs of modern applications and allows for rich annotations with semantic information that can be evaluated and understood by developers and by large language models (LLMs).

{
    "$schema": "https://json-structure.org/meta/extended/v0/#",
    "$id": "https://example.com/schemas/product",
    "$uses": ["JSONStructureAlternateNames", "JSONStructureUnits"],
    "type": "object",
    "name": "Product",
    "properties": {
        "id": {
            "type": "uuid",
            "description": "Unique identifier for the product"
        },
        "name": {
            "type": "string",
            "maxLength": 100,
            "altnames": {
                "json": "product_name",
                "lang:en": "Product Name",
                "lang:de": "Produktname"
            }
        },
        "price": {
            "type": "decimal",
            "precision": 10,
            "scale": 2,
            "currency": "USD"
        },
        "weight": {
            "type": "double",
            "unit": "kg"
        },
        "created": {
            "type": "datetime"
        },
        "tags": {
            "type": "set",
            "items": { "type": "string" }
        },
        "attributes": {
            "type": "map",
            "values": { "type": "string" }
        }
    },
    "required": ["id", "name", "price", "created" ]
}

JSON Structure’s syntax is similar to that of JSON Schema, but while JSON Schema focuses on document validation, JSON Structure focuses on being a strong data definition language that also supports validation.

Primer and Core Specification

The Primer is a high-level overview of the JSON Structure language and its features. It is intended for developers and users who want to understand the language’s capabilities and how to use it effectively.

The JSON Structure Core Specification provides a detailed description of the JSON Structure language, including its syntax, semantics, and data types. It is intended for implementers and developers who want to create tools and libraries that work with JSON Structure.

Extensions