What is the difference between JSON and JSON Schema?

JSON is a text format for data, and JSON Schema is a vocabulary for describing what a JSON document must contain. JSON (JavaScript Object Notation) writes data as objects, arrays, strings, numbers, booleans, and null. JSON Schema is itself written in JSON. It states which fields are required, what type each field has, and what limits apply. A validator reads both documents and reports whether the data satisfies the schema. The word "schema" also has a looser meaning, the structure of any data as opposed to the data itself, and that reading is covered further down.

AspectJSONJSON Schema
What it isA data formatA description of valid data, written in JSON
ContainsValues: objects, arrays, strings, numbers, booleans, nullKeywords: type, properties, required, minimum, enum, pattern
Enforces anythingNo, any well-formed text is acceptedYes, through a validator library
File name conventionconfig.jsonconfig.schema.json
Who reads itApplications and peopleValidators, editors, code generators, documentation tools
StandardECMA-404 and RFC 8259The JSON Schema specification, in numbered drafts

A JSON Document

A JSON document is only values, with no rules attached. The example below describes one product. Nothing in the file says that price must be a number or that sku must be present. A parser accepts it as long as the braces, quotes, and commas are well formed.

{ "sku": "LAMP-204", "name": "Desk lamp", "price": 34.5, "inStock": true, "tags": ["lighting", "office"] }

The JSON Schema for That Document

A JSON Schema states the rules that the document above must follow. The $schema keyword names the draft of the specification being used. type says the root is an object, properties lists the allowed fields with their types, and required names the fields that must be present. additionalProperties: false rejects any field not listed.

{ "$schema": "http://json-schema.org/draft-07/schema#", "title": "Product", "type": "object", "properties": { "sku": { "type": "string", "pattern": "^[A-Z]+-[0-9]+$" }, "name": { "type": "string", "minLength": 1 }, "price": { "type": "number", "minimum": 0 }, "inStock": { "type": "boolean" }, "tags": { "type": "array", "items": { "type": "string" } } }, "required": ["sku", "name", "price"], "additionalProperties": false }

A validator given both files returns a pass. Change "price": 34.5 to "price": "34.5" and the validator reports that price must be a number. Remove sku and it reports a missing required field.

What JSON Schema Can Express

The keywords cover types, ranges, formats, and structure. For numbers there are minimum, maximum, and multipleOf. For strings there are minLength, maxLength, pattern, and format, where format names a known shape such as an email address. For arrays there are items, minItems, and uniqueItems. enum fixes a value to a list of allowed constants.

Schemas can be composed. $ref points to another schema, or to a definitions block in the same file, so a shared Address schema is written once. oneOf, anyOf, and allOf combine schemas. A JSON Schema is also a JSON document, so the specification publishes a meta-schema, which is a JSON Schema that validates other JSON Schemas. That is the file the $schema URL points to.

Where JSON Schema Is Used

JSON Schema is used wherever JSON passes between two parties. An API validates each request body against a schema before the handler runs, so bad input is rejected with a clear message. OpenAPI documents describe request and response bodies with a JSON Schema dialect. Code editors read a schema to offer autocomplete and warnings inside configuration files. Code generators produce classes in Java, TypeScript, or Python from a schema, so both sides agree on the shape.

Data Versus Its Structure

In the looser sense, a schema is the structure of data, and JSON is one way to write the data. A relational database has a schema too. It is the set of tables, columns, types, and constraints, and the rows are the data. The same split applies inside a database when a table has a JSON column. The table schema says the column exists and holds JSON, but the shape of the JSON inside it is unchecked unless the application validates it, for example with a JSON Schema.

This is the trade behind a common design question: several configuration objects per user, stored in a separate table or in one JSON field. A separate table gives the database a structure to enforce and columns to index. A JSON column gives flexibility, and the application takes over the checking.

JSON Schema Versus JSON Type Definition

JSON Type Definition (JTD) is a smaller alternative format. It is defined in RFC 8927 and is aimed at code generation, so it has fewer keywords and maps directly onto types in a programming language. JSON Schema is larger, older, and more widely supported by validators and editors. Most projects encounter JSON Schema first, through an API framework or an editor.

Key Takeaways

TAGS
System Design Interview
CONTRIBUTOR
Arslan Ahmad
Arslan Ahmad
ex-FAANG engineering manager and author or Grokking series.

GET YOUR FREE

Coding Questions Catalog

Design Gurus Newsletter - Latest from our Blog
Boost your coding skills with our essential coding questions catalog.
Take a step towards a better tech career now!
Explore Answers
What Is a Mock Schedule? Meaning, Uses and an Example
A mock schedule is a practice or sample version of a schedule, used to test a plan or to run a mock session such as a practice interview.
What to Expect in the Airtable System Design Interview
Airtable's design rounds favor collaborative editing, spreadsheet-database systems, and large table performance, with a worked walkthrough.
Why should I work for Dell?
Who are the main customers of Palantir?
What are the best practices for API versioning in microservices?
The four API versioning styles compared, which changes actually break clients, and how to retire an old version safely.
What Interview prep bootcamps are good for freshers?
Related Courses
New
Grokking the AI System Design Interview course cover
Grokking the AI System Design Interview
Learn to design AI systems the way interviewers expect: classic ML products, LLM and RAG architectures, and agentic systems, all through the lens of the system design interview.
4.6
(3,192 learners)
Discounted price for Your Region

$99

Grokking the Coding Interview: Patterns for Coding Questions course cover
Grokking the Coding Interview: Patterns for Coding Questions
The 24 essential patterns behind every coding interview question. Available in Java, Python, JavaScript, C++, C#, and Go. The most comprehensive coding interview course with 543 lessons. A smarter alternative to grinding LeetCode.
4.6
Discounted price for Your Region

$197

Grokking Modern AI Fundamentals course cover
Grokking Modern AI Fundamentals
Master the fundamentals of AI today to lead the tech revolution of tomorrow.
4.1
Discounted price for Your Region

$72

Design Gurus logo
One-Stop Portal For Tech Interviews.
Copyright © 2026 Design Gurus, LLC. All rights reserved.