How do you tell the difference between invalid JSON syntax and a schema mismatch?

Validate the JSON syntax first if needed, then run the payload against a schema and inspect which required fields, types, or structural rules failed.

3 min readJSON Schema Validator / JSON Schema Generator / JSON Validator
TL;DRSchema validation answers a different question from plain JSON validation: not just whether the JSON parses, but whether it matches the structure your system expects.

When schema validation matters

Schema validation is the right tool when JSON already parses but still fails an API contract, config requirement, or downstream validation step.

It catches problems such as missing required fields, wrong value types, unexpected properties, and array shape mismatches.

Fast workflow

  1. 1Paste the JSON instance into a schema validator.
  2. 2Paste the JSON Schema into the schema editor.
  3. 3Run validation and inspect whether the payload matches or fails the schema rules.
  4. 4Fix the failing fields or schema rules, then validate again.

Simple schema example

This schema says the payload must be an object with a string service name, a boolean enabled flag, and an array of integer ports.

Example failing payload

This payload is valid JSON syntax, but it still fails the schema because enabled is a string and ports contains a string instead of only integers.

What failing rules usually mean

  • A required-field failure usually means the payload is missing a key the contract expects.
  • A type failure usually means a number, boolean, array, or object came through in the wrong shape.
  • An additionalProperties failure usually means the payload contains keys that are not part of the documented contract.

No Schema Yet?

Generate a starter schema first

Use the schema generator when you have a representative payload but need a first-pass schema before you validate against it.

Generate a starter schema first

Quick answers

What to do next

Start with the right tool now, then move back to the hub or sideways into the adjacent guides if the first answer was not the whole fix.