Format & Edit JSON
Beautify and pretty-print JSON with 2 or 4-space indent.
Readable output with configurable indentation.
Strip whitespace for compact production payloads.
Edit JSON with syntax highlighting and real-time validation.
Browse nested JSON structure visually.
Parse and analyse JSON structure and types.
Human-friendly display of any JSON document.
Sort JSON keys alphabetically for consistent diffs.
Compare two JSON objects and highlight every change.
Escape and stringify JSON for embedding in code.
Collapse JSON to a single line.
Validate JSON
Check JSON syntax and report exact error location.
Validate JSON5 files with comments and trailing commas.
Validate JSON Lines (JSONL/NDJSON) format.
Validate newline-delimited JSON line by line.
Browse NDJSON streams with collapsible records.
Validate TOML configuration files for syntax errors.
Convert JSON
Convert JSON objects to XML format.
Export JSON arrays to CSV spreadsheet.
Convert JSON to YAML configuration format.
Tab-separated values export from JSON arrays.
Serialize JSON to an escaped string literal.
Parse a JSON string back into an object.
Render JSON arrays of objects as an HTML table.
Convert JSON to TOML configuration format.
Convert TOML configs to JSON for tooling.
Convert a JSON array into newline-delimited records.
Combine NDJSON lines into a single JSON array.
Generate a GraphQL schema from a JSON sample.
Convert a GraphQL SDL schema into a JSON AST.
Render JSON as a readable Markdown document or table.
Parse Markdown structure into a JSON tree.
Convert OpenAPI / Swagger YAML specs to JSON.
Convert JSON into HashiCorp Terraform HCL syntax.
Encode JSON to compact MessagePack binary format.
Decode MessagePack binary data back to JSON.
Encode JSON to CBOR (RFC 8949) binary format.
Decode CBOR binary payloads back to JSON.
Encode & Escape
Escape special characters for safe embedding.
Unescape a JSON string to its raw form.
URL-encode JSON for query strings.
Decode URL-encoded JSON back to readable form.
Encode JSON to Base64 for safe transport.
Decode Base64-encoded JSON payloads.
Generate Code from JSON
Generate TypeScript interfaces.
Generate Python dataclass or dict.
Generate Java POJO classes.
Generate C# model classes.
Generate Go structs.
Generate Rust structs with serde.
Generate Swift Codable structs.
Generate Kotlin data classes.
Generate Dart model classes.
Generate Ruby struct or hash.
Generate iOS NSObject @interface from JSON.
Generate JSON Schema (Draft 2020-12) from sample data.
Generate C++ struct with std::string / std::vector fields.
Generate Crystal class with JSON::Serializable.
Generate React PropTypes definitions from JSON shape.
Generate Flow type alias from JSON sample.
Generate Elm record + JSON decoder.
Generate Pike typed mapping from JSON.
Generate Haskell data type with Aeson.
What is JSON? A Complete Developer Overview
JSON (JavaScript Object Notation) is a lightweight, text-based data interchange format defined in RFC 8259. Despite the "JavaScript" in its name, JSON is completely language-agnostic — every major programming language has native JSON support, from Python and Go to Java, Rust, and Swift.
JSON became the dominant format for web APIs because it maps directly to the data structures found in every programming language: objects (key-value maps), arrays (ordered lists), strings, numbers, booleans, and null. Unlike XML, JSON has no attributes, no namespaces, and no processing instructions — what you see is what you get.
Raw JSON returned by APIs is typically minified — packed into a single line to reduce bytes over the wire. To read it, use our JSON formatter to pretty-print it with proper indentation. To check whether it is syntactically correct before using it in code, use our JSON validator, which reports the exact line and character of any error.
JSON Data Types
JSON supports exactly six data types. Every value in a JSON document must be one of these:
| Type | Example | Notes |
|---|---|---|
| String | "Hello, world!" | Double quotes only. Escape special chars with \. |
| Number | 42, 3.14, -17 | Integer or float. No NaN, Infinity, or hex. |
| Boolean | true, false | Lowercase only. True and False are invalid. |
| Null | null | Represents absence of value. Lowercase only. |
| Object | {"key": "value"} | Unordered key-value pairs in { }. |
| Array | [1, 2, 3] | Ordered list of any JSON values in [ ]. |
See JSON examples by use case for copy-ready JSON showing each type in real-world contexts.
JSON Syntax Rules
JSON has a small, strict set of rules. Violating any of them creates a JSON syntax error that prevents parsing:
Keys must be double-quoted strings
Invalid
{name: "Alice"}Valid
{"name": "Alice"}No trailing commas
Invalid
{"a": 1,}Valid
{"a": 1}No comments (// or /* */)
Invalid
{"a": 1 // note}Valid
{"a": 1}Strings need double quotes
Invalid
{'a': 'Alice'}Valid
{"a": "Alice"}No undefined, NaN, or Infinity
Invalid
{"x": undefined}Valid
{"x": null}Arrays use square brackets
Invalid
{"list": (1,2,3)}Valid
{"list": [1,2,3]}For a full breakdown of every error type, visit the JSON errors guide. To automatically detect and locate errors in your JSON, use the JSON validator tool.
When to Use Each JSON Tool
JSON workflows vary by task. Here is a quick decision guide for which tool to reach for — and when multiple tools should be used in sequence.
You received a minified API response and need to read it
Paste the response → click Beautify → read the structured output.
Your API call returns 400 Bad Request or your JSON breaks parsing
Paste the request body into the validator. It reports the exact line and character of the error. Cross-reference with the errors guide to fix it.
You want to compare two versions of a JSON config or API response
Paste both JSON objects side by side. The tool highlights every addition, removal, and change with colour coding.
You need to share or store JSON compactly (reduce payload size)
Paste formatted JSON → click Minify → copy the single-line output.
You want to generate TypeScript interfaces or Python classes from a JSON sample
Paste a representative JSON sample. The generator produces typed code matching the structure.
You want to import JSON data into a spreadsheet
Paste a JSON array of objects → convert → download or copy the CSV output.
You're new to JSON and need to understand the format
Read the tutorial for syntax fundamentals, then browse examples for real-world patterns you can copy directly.
JSON vs XML vs YAML
| Feature | JSON | XML | YAML |
|---|---|---|---|
| Human readability | Good | Moderate (verbose) | Excellent |
| File size | Compact | Large (tag overhead) | Compact |
| Comments | Not supported | <!-- Supported --> | # Supported |
| Best for | Web APIs, data storage | Documents, SOAP, SVG | Config files, CI/CD |
| Browser support | Native (JSON.parse) | Via DOMParser | Needs library |
| Schema validation | JSON Schema | XSD, DTD | JSON Schema (subset) |
JSON dominates web APIs because it maps directly to objects and arrays in every programming language. If you work with XML data and need to convert it, use our XML to JSON converter. For YAML config files, the YAML to JSON converter translates between formats instantly.
JSON Knowledge Base
JSON Guides & Learning Resources
Beyond the tools — understand JSON deeply. These guides pair with every tool above to help you debug faster, write better JSON, and avoid the most common mistakes.
JSON Tutorial
Complete guide to JSON syntax, data types, objects, arrays, and nested structures.
JSON Errors Guide
Every common JSON syntax error with exact error messages and before/after fixes.
JSON Examples
Copy-ready valid JSON for API responses, config files, nested objects, and more.
JSON Validation Guide
When and how to validate JSON — syntax rules, schema validation, and common pitfalls.
How to Fix Invalid JSON
Step-by-step guide to diagnosing and fixing every type of JSON parse error.
JSON Format Explained
Deep dive into the JSON specification — types, nesting rules, encoding, and edge cases.
Frequently Asked Questions About JSON
What is JSON?expand_more
What is the difference between a JSON formatter and a JSON validator?expand_more
How do I fix a JSON syntax error?expand_more
What is the difference between JSON and YAML?expand_more
What is the difference between JSON and JSON5?expand_more
Are these JSON tools free?expand_more
Can I generate TypeScript or Python code from JSON?expand_more
What is JSONL (JSON Lines)?expand_more
Developer Insights
From the Blog
How to Use a JSON Formatter: The Complete Guide
Everything about JSON formatters — how they work, when to use them, and what to look for in a good online JSON beautifier.
Why JSON Formatting Matters More Than You Think
How proper JSON structure prevents production bugs, improves debugging, and makes code reviews faster.
YAML vs JSON in 2024: When to Use Each
A definitive guide on choosing the right data serialization format for modern infrastructure.