Paste example JSON and get a JSON Schema that describes it: the type of each field, which keys are required, which can be null, and the shape of nested objects and lists. Give it several records in a list for the best result, since a schema made from one record marks every key as required. To check data against the schema, use the JSON Schema Validator. For TypeScript interfaces instead, use JSON to TypeScript.
How to use it
- Paste JSON (several examples in a list work best) or open a file.
- The schema appears as you type.
- Copy it or download a .schema.json file, or open the data in GigaJSON to validate it against the schema.
Read more: A JSONLint alternative for large JSON files · How to create a JSON Schema from JSON
Private, and made for big files
This tool runs in your browser, in a background worker: nothing you paste or open is uploaded, and nothing is kept after you leave. JSON and XML input can be up to 1 GB, depending on available memory. Processing runs in a background worker; large analyses can take a minute or more. Already loaded features keep working if your connection drops. Loading another tool or jq for the first time needs a connection. When one tool isn't enough, GigaJSON opens your data with a tree, a table, JSONPath/JMESPath/jq queries, transforms, diff and history.
How JSON becomes a JSON Schema
Two users and a map of teams:
{
"users": [
{ "id": 1, "name": "Ada", "score": 9.5, "tags": ["admin"], "manager": null },
{ "id": 2, "name": "Linus", "score": 7, "tags": [], "manager": 1, "email": "linus@example.com" }
],
"teams": { "101": { "lead": "Ada" }, "102": { "lead": "Linus" } }
}
give this schema (indentation shortened here):
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"users": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": { "type": "integer" },
"name": { "type": "string" },
"score": { "type": "number" },
"tags": { "type": "array", "items": { "type": "string" } },
"manager": { "type": ["null", "integer"] },
"email": { "type": "string" }
},
"required": ["id", "name", "score", "tags", "manager"]
}
},
"teams": {
"type": "object",
"additionalProperties": {
"type": "object",
"properties": { "lead": { "type": "string" } },
"required": ["lead"]
}
}
},
"required": ["users", "teams"]
}
| In the data | In the schema |
|---|---|
id is 1 and 2 | "integer". A field with both 9.5 and 7, like score, is "number". |
manager is null once and 1 once | ["null", "integer"] |
email is in one user only | Listed in properties, left out of required |
Every item of users is an object | One items schema that merges all of them |
teams has number-like keys | additionalProperties, so new team IDs stay valid |
| A list mixing types | anyOf with one entry per type |
Objects keyed by IDs count as maps when the keys are numbers, or when there are at least eight keys whose values all have the same fields. Anything else is read as a fixed set of properties.
Questions
How are required keys decided?
A key that appears in every object of a list is required. One that's missing from some of them is optional.
Which JSON Schema version is it?
It declares draft 2020-12, and sticks to keywords that earlier drafts share (type, properties, items, required).
Does it detect formats like email or date-time?
No. A string is typed as string, and no enum, pattern, minimum or format is guessed from a few examples. Add the ones you want by hand, such as "format": "email".
Can I validate JSON against the schema?
Yes. Paste both into the JSON Schema Validator, or open the data in GigaJSON and use Types, then Validate. Both check against draft 4, 7, 2019-09 or 2020-12 and list each error with its path.
Why is a field typed as ["null", "integer"]?
The field was null in at least one example and a whole number in another. If null should not be allowed, remove "null" from the list.
Is my data uploaded?
No. The tool runs in your browser, in a background worker. Nothing you paste or open goes to a server, and nothing is kept after you leave the page.
All tools
- JSON FormatterIndent with 2 or 4 spaces, sort keys
- JSON ValidatorLine and column of the first error
- JSON MinifierRemove whitespace, see the bytes saved
- JSON RepairFixes quotes, commas, comments, AI output
- JSON Schema GeneratorA JSON Schema from examples
- JSON Schema ValidatorCheck JSON against a schema
- JSON Token CounterCount tokens, select data, compare JSON and TOON
- JSON EditorTree and code editing, undo and history
- Large JSON ViewerTree, table and search for huge files
- JSON Lines ViewerJSONL and NDJSON logs as a table
- JSON Log ViewerCount and filter JSON Lines logs
- Large CSV ViewerCSV files too big for Excel, up to 1 GB
- JSON VisualizerThe data as a graph, PNG and SVG export
- JSON DiffChanges between two documents
- JSON Path FinderClick a value, copy its path
- JSONPath TesterJSONPath, JMESPath and jq, live
- JMESPath PlaygroundJMESPath, for AWS CLI queries too
- jq PlaygroundReal jq in your browser
- JSON to CSVNested objects become dotted columns
- JSON to ExcelAn .xlsx sheet, numbers kept as numbers
- CSV to JSONDelimiters detected, 007 stays 007
- JSON to XML@keys become attributes
- XML to JSONRSS feeds, sitemaps, SOAP responses
- JSON to YAMLReadable YAML, ambiguous strings quoted
- YAML to JSONAnchors and multiple documents
- JSON Lines to JSONNDJSON or JSONL into one array
- JSON to JSON LinesA JSON array as one record per line
- JSON to TOONConvert JSON to TOON, with token counts
- JSON to MermaidA flowchart or class diagram, drawn
- JSON SplitterCut a big file into parts, or sample it
- JSON to TypeScriptInterfaces inferred from your data
- JSON to GoGo structs with json tags
- JSON to RustRust structs that derive serde's Serialize and Deserialize
- JSON to PythonPython dataclasses with type hints
- JSON to JavaJava classes with getters and setters
- JSON to C#C# classes with System.Text.Json attributes
- JSON to KotlinKotlin data classes
- JSON to SwiftSwift structs that conform to Codable, with CodingKeys
- JSON to DartDart classes with fromJson and toJson
- JSON to ZodZod schemas with TypeScript types inferred from them
- JWT DecoderHeader, payload and expiry, locally
- JSON EscapeText to a JSON string and back
- Sample JSON FilesDownload test JSON, 100 KB to 1 GB
- Sample JSON Lines FilesDownload test NDJSON, one record per line
- Sample CSV FilesDownload test CSV, 100 KB to 1 GB
- Sample XML FilesDownload test XML, 100 KB to 1 GB
- Sample GeoJSON FilesPoints, lines and polygons, up to 1 GB
- Sample Nested JSONRecords 8 levels deep, up to 1 GB
- Sample Unicode JSON13 scripts, emoji and escapes
- Sample API ResponsesJSON:API, HAL, GraphQL, pages, errors
- Large JSON File GeneratorTest data from 100 KB to 1 GB