Skip to main content

Compare · Config and schemas

Stof vs JSON Schema.

JSON Schema describes what valid JSON looks like, in a separate file with a separate validator. In Stof, the rules live in the same document as the data, and they can be any function.

JSON Schema

A declarative language for the structure and constraints of JSON data.

Stof

Just-in-time software: data and logic together, in one document that runs anywhere, sandboxed, in Rust, JavaScript, and Python.

What happens when…

When…JSON SchemaStof
You need to check the dataKeywords describe structure and constraints, and a validator checks documents against them.#[schema] rules on a type check any object, in the same doc as the data and the logic.
A rule that needs logicLimited to what the keywords express.A #[schema] rule is a function, so it can be any check you can write.
Where the data livesIn its own file, next to the data it describes.In the same doc as the data, and it can compute values too.
The logic has to run somewhere elseA schema is JSON, easy to send. The logic that uses the data travels some other way.Send the doc as text or compact binary: its data, its functions, and its current state, in one payload. The other side gives the same answer, in Rust, JavaScript, or Python.
EcosystemA widely supported standard (latest: 2020-12), used by OpenAPI and countless tools.Imports and exports JSON, so it works next to the tools you have.

Checked December 3, 2026. Sources: What is JSON Schema?. Something out of date? Tell us.

What you'd still build.

On top of JSON Schema
  • Checks the keywords can't express
  • The logic that uses the valid data
  • A way to keep schema and data together
Already in Stof
  • #[schema] rules that are functions
  • Functions, types, units, and tests in the same doc
  • #[schema] checks in the same doc as the data

Choose JSON Schema when a standard, language-neutral contract (like an OpenAPI spec) is the point.

Stof vs JSON Schema, answered.

Can I use both?

Yes. Stof reads and writes JSON, so a document can be validated by JSON Schema at the edges and use #[schema] for the rules only code can express.

Also compared.

Every comparison →

Try it in a minute.

npm i @formata/stof
pip install stof
cargo add stof