JSON Quiet

JSON Schema vs RFC 8259 validation

By Bruno J F Costa · A valid document can still be the wrong shape for your API.

When JSON Quiet says “Valid JSON,” it means the text matches the JSON grammar: braces, quotes, commas, numbers, true/false/null. That is RFC 8259 syntax. It is necessary. It is not sufficient for an API contract.

{"userId": "oops", "items": null}

That object is valid JSON. If your service required userId to be an integer and items to be an array of SKUs, the request is still wrong. Syntax validation will not save you. Schema validation might.

What syntax validation is for

Use strict Validate when you need to know whether JSON.parse, json.loads, or encoding/json will accept the bytes. That catches the problems in the errors guide and the JavaScript-versus-JSON gap. Do this before you commit a fixture or paste a body into a ticket. Details of modes are on the RFC 8259 page.

JSON Quiet does not apply JSON Schema, OpenAPI, or TypeScript types. That is intentional. A formatter should not pretend it knows your business fields.

What a schema adds

JSON Schema (and similar systems) describe shape: required properties, types, enums, formats (email, date-time), array length, nested objects. OpenAPI often embeds a schema for each request and response. Your backend may generate types from the same source.

A schema answers questions syntax cannot: “Is status one of open|closed?” “Must items have at least one element?” “Is this extra property forbidden?” Those checks belong in CI, in the API gateway, or in a dedicated schema tool — after the document is already legal JSON.

A two-layer habit

  1. Make it parse. Format and Validate on JSON Quiet (or in your editor).
  2. Make it match the contract. Run the project’s schema tests or an OpenAPI validator against the same file.
  3. Only then treat the fixture as ready to ship.

Skipping layer 1 wastes time: schema tools emit confusing errors when the input is not even JSON. Skipping layer 2 ships “valid” garbage.

When you do not need a schema yet

Scratch debugging of an unknown third-party response often starts with pretty-print and reading. You are mapping keys by eye (see nested keys). A schema comes later, when the shape is stable enough to encode. Do not invent a 200-line schema for a one-off log line.

Conversely, if you already have an OpenAPI file, do not weaken it because “the formatter said it was valid.” The formatter never saw your spec.

Relaxed mode is not a schema

Relaxed validation on this site is a workshop setting for trailing commas and similar cleanup. It does not mean “close enough for production.” It also does not check types. After you clean the paste, switch back to strict RFC 8259, then run your real schema suite.

Related guides

Validate RFC 8259 · JSON vs JavaScript · Nested keys · All guides

Check syntax first →