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.

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

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

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, standard library only. No plugins, no code generation.

{ }

Flatten & target

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

Operator pipelines

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

?

Conditions with boolean logic

Gate fields with when and dependsOn, composing any, all, and not groups as deep as the rule needs.

!

Errors with stable codes

Every failure carries a machine-readable code that survives rewording and translation. Never a panic.

/

Pointers and problem+json

Each error knows its RFC 6901 location, and any handler can answer with an RFC 7807 response.

@

HTTP request validation

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

Message catalogs

Load per-locale message bundles from JSON or TOML, with fallback chains and ICU-style plurals.

~

Observability hooks

Observer, metrics, and tracing adapters that cost a nil check when nothing is attached.

Streaming and a CLI

Validate arrays that do not fit in memory, and check schemas in CI without writing any Go.

Validate your first document in five minutes.

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

Get startedBrowse examples