v2.0 · zero dependencies, Go 1.24

JSON that arrives messy,
leaves validated.

Flatten any document into dotted keys, target them with wildcards or regex, then run each value through a pipeline of validators and operators. Typed errors, no panics.

Open the playgroundRead the docs
$go get github.com/ashbeelghouri/json-schematics-v2@latest
The gap

Validation libraries assume your JSON is well behaved.

01

Struct tags can't bend

Go's tag validators hard-code the shape at compile time. Third-party payloads and dynamic forms don't fit that mold.

rigid
02

One assertion, one panic

Reflection-heavy validators panic on the value they didn't expect. A bad request shouldn't take down the handler.

unsafe
03

Rules live in code, not data

Changing a rule means a redeploy. Schematics keeps rules as JSON, so a schema is data you can load, ship, and localize.

declarative
How it works

Watch one document move through the pipeline.

Five stages, each colored by what it does. Hover to pause, click a stage to inspect it.

Any nested document collapses into dotted keys. Objects and arrays become paths like user.tags.0.

input
user{ profile, tags }
user.profile{ name, age }
user.tags[ ... ]
flattened
user.profile.name" ada "
user.profile.age200
user.tags.0"go"
user.tags.1"go"

One small library, a lot of leverage.

Everything below ships in the box. No plugins, no code generation.

{ }

Flatten & target

Nested documents become dotted keys. Match one literally, sweep an array with *, or use a full regex.

!

Typed, localizable errors

Every failure is a ValidationError with per-locale messages and clean JSON. Never a panic.

Operator pipelines

Transform values in a separate pass: trim, capitalize, math, and reshape arrays into objects.

?

Conditions & dependencies

Gate fields with when and dependsOn so rules run only when they actually apply.

@

HTTP request validation

Validate request headers, query, and body per endpoint with the API type.

0

Zero dependencies

Standard library only, Go 1.24. Register your own rules and operators with typed signatures.

Validate your first document in five minutes.

Follow the guide, or try a live schema in the playground right now.

Get startedBrowse examples