What the validator checks
JSON:API Lens runs the following checks against every document. Each finding includes a severity, a rule name, an explanation, and a JSON pointer.
- Required type identifiers and string ids — every resource needs a
type, andidmust be a string. - Reserved field names —
type,id, andlidcannot appear insideattributes. - Attribute / relationship collisions — the same name cannot be both an attribute and a relationship.
- Relationship object shape —
data,links, andmetamust have the correct types, includingnulland arrays for to-many relationships. - Duplicate resources — the same
type/idpair must not appear twice indataorincluded. - Full linkage — every included resource must be reachable from the primary data through relationships.
- Resource identifier objects — linkage objects need a valid
typeandid/lid. - Top-level data / errors exclusivity — a document must not contain both
dataanderrors. - Error document structure — error objects must follow the specification's shape.
The full rule set is implemented in core.js and covered by the project's test suite. The
validator targets JSON:API 1.1; documents written for 1.0 generally pass as well.
How to validate a JSON:API response
- Open the viewer and paste or upload the document.
- Look at the summary bar: it shows error and warning counts immediately.
- Open the Issues tab for the full report, grouped by severity.
- Use the JSON pointer on each finding to jump to the exact location in the document.
Validation runs locally and instantly. Large reports are paginated, and Copy all issues exports the complete report as JSON.
Common JSON:API errors and how to fix them
| Finding | Typical cause | Fix |
|---|---|---|
| id must be a string | A database integer was serialized directly. | Cast ids to strings at the serializer boundary. |
| type is missing | The serializer emitted a bare object or partial resource. | Include type on every resource and identifier. |
| data and errors cannot coexist | An error handler merged an error into a success payload. | Return either a data document or an errors document, never both. |
| Duplicate resource | The same object was added to data and included, or twice to included. |
Deduplicate by type/id before serializing. |
| Included resource is not linked | An included object is not referenced by any relationship. | Either link it from a relationship or remove it from included. |
| Relationship data has the wrong shape | A to-one relationship was serialized as an array, or vice versa. | Use an object or null for to-one, an array for to-many. |
What validation cannot tell you
Structural validation is not schema validation. The validator cannot know that a title is
required by your application, that an attribute should match a pattern, or that a user is allowed to see
a resource. It also cannot detect a relationship that is semantically wrong but structurally
valid.
data or
included, that is not a specification violation — the viewer marks it as
missing so you can decide whether it was intentional.
Frequently asked questions
What does a JSON:API validator check?
It checks structural rules from the JSON:API 1.1 specification: required type and string id members, reserved field names, attribute and relationship collisions, relationship object shape, duplicate resources, full linkage from primary data, resource identifier objects, data and errors exclusivity, and error document structure.
Does the validator check my business rules?
No. It validates the JSON:API document structure only. Required attributes, authorization, and domain-specific rules are outside the scope of the specification and of this validator.
Is the JSON:API validator free?
Yes. It is free, open source, and runs entirely in your browser. No document is uploaded.
Validate a response now
Structural checks, JSON pointers, and a copyable report.