Validation/schema

Joi Schema Playground

Validate a JSON payload with an allowlisted Joi object schema, see error.details, inspect the coerced value and copy a readonly Joi snippet without uploading data or running raw JavaScript.

Schema
40 KiB
Payload
50 KiB
Worker
3000 ms

Validate with controlled Joi rules

The playground compiles only object, string, number, boolean and array rules from a JSON DSL. Raw Joi code, custom extensions, refs and custom regular expressions are blocked before validation.

ReadyChoose a preset or edit the controlled DSL, then validate a JSON payload.

Email, integer age, default role and tag array with stripUnknown enabled.

Schema DSL

allowlisted JSON

Payload JSON

local only

Validation result

error.details

0

No Joi issues to display yet.

Validated value

{
  "result": "not run yet"
}

Readonly Joi snippet

const schema = Joi.object({
  "email": Joi.string().email().required(),
});

const result = schema.validate(payload, {
  "abortEarly": false,
  "convert": true,
  "stripUnknown": true
});

Diagnostics

0

Diagnostics appear after a validation run.

When Joi is the right contract tool

Joi is useful when a JavaScript or Node team wants runtime validation with readable constraints, defaults, conversion and rich error.details output. This public page focuses on the review-friendly part of that workflow: small JSON payloads, object schemas and explicit validation options.

The playground does not behave like a full Node sandbox. It never executes pasted Joi code, never loads custom extensions and never resolves remote packages. That keeps the route safe for public use while still showing the practical difference between the input payload and the validated/coerced value.

Joi Schema FAQ

Does this execute raw Joi code?

No. The page compiles a controlled JSON DSL and shows a readonly snippet for education and copying.

Why block custom regex and extensions?

They widen the public safety surface and are better tested inside a real repository where code ownership is clear.

When should I use Joi instead of Zod?

Use Joi when runtime validation, conversion, defaults and detailed validation errors matter more than TypeScript-first inference.

When should I use JSON Schema instead?

Use JSON Schema or Ajv when you need language-neutral contracts, OpenAPI alignment or schema exchange between services.

Is data sent to a backend?

No. Validation runs in a browser worker and the page does not persist schema or payload content.