JSON-Formatierer

JSON formatieren, Struktur prüfen und Ausgabe komprimieren.

// about

Über dieses Tool

JSON-Text sieht oft wie ein unleserlicher Block aus. Dieses Tool fügt automatisch Zeilenumbrüche und Einrückungen ein, damit alles übersichtlich wird.

So verwenden Sie es

  1. Fügen Sie Ihren JSON-Text in das obere Feld ein.
  2. Klicken Sie auf 'Ausführen' oder wählen Sie 'Komprimieren'.
  3. Kopieren Sie das fertige Ergebnis.

Warum dieses Tool genutzt wird

  • Bringt Ordnung in unübersichtlichen JSON-Code mit nur einem Klick.
  • Findet fehlende Anführungszeichen oder Kommas sofort.
  • Kann den Text komprimieren (minify), um Daten schneller zu übertragen.

Häufig gestellte Fragen (FAQ)

Was ist JSON?

JSON ist ein einfaches Format, mit dem Computer Daten in geschweiften Klammern austauschen.

Werden meine Daten gespeichert?

Nein, die Verarbeitung läuft komplett lokal in Ihrem Webbrowser ab.

Was tun bei einer Fehlermeldung?

Prüfen Sie, ob ein Komma oder ein Anführungszeichen im Eingabetext fehlt.

Ratgeber · Daten · 8 Min. Lesezeit

JSON-Syntaxfehler beheben: Die 7 häufigsten Fehler und wie Sie JSON aufräumen

API-Antworten, Konfigurationsdateien, Logs: JSON ist das Datenformat, das Entwickler am häufigsten lesen. Trotzdem kann ein einziges Komma oder Anführungszeichen einen „Unexpected token“-Fehler auslösen. So finden Sie die Ursache schnell.

JSON (JavaScript Object Notation) ist ein Textformat, das in RFC 8259 und ECMA-404 standardisiert ist. Es stammt aus JavaScript, wird heute aber von fast jeder Sprache unterstützt. Es gibt nur sechs Werttypen: String, Zahl, Boolean (true/false), null, Array und Objekt.

{
  "id": 1024,
  "name": "AIBIZAP",
  "active": true,
  "tags": ["tools", "guides"],
  "owner": null
}
JSON-Grundlagen, sieben häufige Parse-Fehler, Fallstricke bei großen Zahlen und Datumswerten und wie Sie JSON in Klassen oder Tabellen umwandeln.
Ratgeber lesen →
Mit KI bauen

Dieses Tool selbst mit KI bauen

Sie möchten eine eigene Version? Kopieren Sie den Arbeitsauftrag in einen KI-Chat oder speichern Sie die Skill-Datei für einen KI-Coding-Agenten. Beide enthalten die Funktionen, Sonderfälle und Testfälle, die wir verwendet haben.

Prompt und Skill sind auf Englisch, das KI-Tools in jeder Sprache gut verstehen.

KI-Arbeitsauftrag (Prompt)

Unverändert in Claude, ChatGPT oder Gemini einfügen.

You are an experienced full-stack web developer. Build a web tool called "JSON-Formatierer" that meets the requirements below.

## Goal

Build a tool that validates JSON and pretty-prints or minifies it.

## Core features

- Validation with error line and column
- Indent with 2 spaces, 4 spaces or tabs
- Minify mode
- Optional alphabetical key sorting
- Copy result and download as .json

## Inputs

- JSON text
- Indentation, sorting and mode options

## Outputs

- Formatted or minified JSON
- Error message with position

## Edge cases and handling rules

- Explain common errors such as trailing commas, single quotes and comments in plain language
- Preserve integers larger than 2^53 exactly
- Strip a leading BOM
- Stay responsive with multi-megabyte input

## Implementation requirements

- Build it as a single page (HTML, CSS, JavaScript) that runs entirely in the browser, and never send the user's input to a server.
- Make the UI responsive and easy to use on mobile; label every input and keep everything keyboard accessible.
- Add a Copy button for results and show clear, friendly error messages for invalid input.
- Keep the core logic in functions separate from the UI so it can be unit-tested.

## Definition of done (test cases)

- '{"a":1,}' is reported as a trailing comma error
- Formatting then minifying keeps the same meaning
- 12345678901234567890 is preserved

First outline your implementation plan in at most five lines, then write the complete code, and finally explain how to check the test cases above.

Skill (SKILL.md)

Als .claude/skills/build-json-formatter/SKILL.md speichern, damit Agenten wie Claude Code es bei jeder Änderung am Tool wiederverwenden.

---
name: build-json-formatter
description: Use when building or changing a JSON-Formatierer tool. Build a tool that validates JSON and pretty-prints or minifies it.
---

# Build: JSON-Formatierer

## Goal

Build a tool that validates JSON and pretty-prints or minifies it.

## Workflow

1. Review the required features, inputs and outputs below and ask about anything missing first.
2. Implement the core logic as pure functions separate from the UI.
3. Check the logic against the test cases in the verification list.
4. Build a responsive UI with an input form, a result area and a Copy button.
5. Reproduce each edge case listed under Rules and refine the error messages.

## Core features

- Validation with error line and column
- Indent with 2 spaces, 4 spaces or tabs
- Minify mode
- Optional alphabetical key sorting
- Copy result and download as .json

## Inputs

- JSON text
- Indentation, sorting and mode options

## Outputs

- Formatted or minified JSON
- Error message with position

## Rules

- Explain common errors such as trailing commas, single quotes and comments in plain language
- Preserve integers larger than 2^53 exactly
- Strip a leading BOM
- Stay responsive with multi-megabyte input
- Build it as a single page (HTML, CSS, JavaScript) that runs entirely in the browser, and never send the user's input to a server.

## Verification

- [ ] '{"a":1,}' is reported as a trailing comma error
- [ ] Formatting then minifying keeps the same meaning
- [ ] 12345678901234567890 is preserved

Tipps für die Arbeit mit KI

  • Nennen Sie in der ersten Zeile Ihren Stack (React, Vue oder reines HTML), damit der Code passt.
  • Lassen Sie die KI die Testfälle ausführen und die Ergebnisse zeigen, bevor Sie den Code übernehmen.
  • Fügen Sie keine echten Passwörter, Kundendaten oder API-Schlüssel ein; nutzen Sie Beispielwerte.