Vollstaendiger JSON-Leitfaden

Free Formatieren · Validieren · Konvertieren · Best Practices No signup · No data stored · Works offline

Tools in diesem Leitfaden

JSON Formatter & Validator
Format, validate, minify and fix JSON
JSON to YAML Converter
Convert JSON to Kubernetes-ready YAML
JSON to CSV Converter
Export JSON arrays as spreadsheets
JSON to XML Converter
Convert JSON to well-formed XML
JSON to TOML Converter
Convert JSON to Rust/Python configs
JSON to TOON Converter
Token-efficient format for LLMs
YAML Formatter
Format and validate YAML config files
Base64 Encoder
Encode binary data for JSON payloads
Last updated: March 2026  ·  v1.0
Quick Answer
What is JSON formatting and why does it matter?

JSON formatting rewrites raw, minified JSON with consistent indentation to make it human-readable and debuggable. The 5 most important things to know:

  1. Use 2-space indent for web projects (Node.js/JS default), 4-space for Python/Java.
  2. All keys and string values must use double quotes — single quotes are invalid JSON.
  3. Trailing commas always cause parse errors, even after the last array/object element.
  4. JSON has no comment syntax — // and /* */ both break parsing.
  5. Dates have no native type — always use ISO 8601 strings: 2024-01-15T10:30:00Z.

JSON (JavaScript Object Notation) is the universal language of web APIs, configuration files, and data exchange. Whether you are debugging an API response, migrating data between systems, or configuring a cloud service, you need reliable JSON tooling in your browser — no install, no signup, no data leaving your machine.

What is JSON and why does formatting matter?

JSON is a lightweight text format derived from JavaScript object syntax. It uses key-value pairs and ordered lists to represent structured data, and every major programming language can parse and generate it natively.

Raw JSON from an API often arrives minified — a single line with no whitespace. While this saves bandwidth, it is unreadable to humans. A JSON formatter reindents it with consistent spacing, making nested structures instantly visible. Proper formatting is not cosmetic: it directly affects your ability to spot missing brackets, misplaced commas, and type mismatches that cause runtime errors.

JSON formatting: 2-space, 4-space, or tab?

The JSON specification (RFC 8259) imposes no indentation rules. In practice, three conventions dominate.

2-space indentation is favoured by JavaScript and Node.js communities. It balances readability with compactness, keeping deeply nested structures on screen without horizontal scrolling. Most linters and editors default to 2 spaces for JSON.

4-space indentation is common in Python and Java projects. It makes each nesting level more visually distinct, which helps when reading deeply nested API responses.

Tab indentation allows each developer to choose their display width in their editor. It is common in C and Go projects. Our JSON Formatter supports all three. For most web API work, 2-space is the right default.

Common JSON validation errors and how to fix them

JSON is strict — a single character out of place breaks the entire document. Here are the five most common errors:

Trailing commas — JSON forbids a comma after the last item in an object or array. {"a":1, "b":2,} is invalid. Use the Fix Quotes button to catch this automatically.

Single quotes — JSON requires double quotes for all strings and keys. {'key': 'value'} is invalid JSON. Use the Fix Quotes button to convert automatically.

Unquoted keys — JavaScript objects allow bare keys, but JSON does not. Every key must be a double-quoted string.

Comments — JSON has no comment syntax. Both // and /* */ comments cause parse errors. Strip them before validating.

NaN and Infinity — Valid in JavaScript but not in JSON. Replace with null or a sentinel number like -1.

Converting JSON to other formats

Different systems need data in different shapes. Here is when to use each converter:

JSON → YAML — YAML is the standard for Kubernetes manifests, Docker Compose files, GitHub Actions workflows, and most CI/CD pipelines. Convert when moving configuration from a JSON-based tool to a YAML-based one.

JSON → CSV — Spreadsheet tools and data pipelines expect CSV. Convert a JSON array of objects to a CSV where each object becomes a row and each key becomes a column header.

JSON → XML — Legacy enterprise systems, SOAP APIs, and many Java frameworks use XML. Convert JSON payloads to well-formed XML for integration with these systems.

JSON → TOML — Rust's Cargo, Python's pyproject.toml, and Hugo's config files use TOML. TOML is more explicit than YAML and better suited for human-edited configuration files.

All conversions run entirely in your browser. No data is sent to any server.

JSON best practices for APIs and configuration

Use snake_case for keys consistently across your API. Mixing userId and user_id in the same codebase creates unnecessary mapping code.

Avoid deeply nested structures. If your JSON is 6+ levels deep, it is a sign the data model needs refactoring. Flat structures are easier to serialize, deserialize, and cache.

Represent missing data as null, not absent. {"email": null} communicates intent better than omitting the key entirely.

Use ISO 8601 for dates. JSON has no native date type. Always use strings in ISO 8601 format (2024-01-15T10:30:00Z) rather than Unix timestamps or locale-specific formats.

Validate at the boundary. Parse and validate incoming JSON at the edge of your system before it flows into your business logic. JSON Schema is the standard tool for this.

Häufig gestellte Fragen zu JSON

Was ist der Unterschied zwischen JSON und JSON5?

JSON5 ist eine Erweiterung, die JSON um Kommentare, nachgestellte Kommas, Schlüssel ohne Anführungszeichen und Strings in einfachen Anführungszeichen ergänzt. Die meisten APIs und Parser erwarten striktes JSON (RFC 8259), nicht JSON5.

Kann JSON Binärdaten enthalten?

Nicht direkt. Der Standardansatz besteht darin, Binärdaten Base64-zu kodieren und als JSON-String zu speichern. Unser Base64-Encoder übernimmt diese Konvertierung.

Was ist die maximale Größe einer JSON-Datei?

Die JSON-Spezifikation hat keine Größenbeschränkung. Praktische Grenzen ergeben sich aus dem Speicher Ihres Parsers. Unser Formatter verarbeitet große Dateien effizient im Browser.

Ist JSON dasselbe wie ein JavaScript-Objekt?

Nein. Ein JavaScript-Objekt ist eine Laufzeit-Datenstruktur. JSON ist ein Text-Serialisierungsformat. Funktionen, undefined und Symbole sind keine gültigen JSON-Werte.

Wie minimiere ich JSON für die Produktion?

Verwenden Sie die Minify-Schaltfläche unseres JSON-Formatters. Die Minimierung entfernt allen Leerraum und reduziert die Dateigröße bei typischen API-Nutzlasten um 20–60 %.