Formatieren, validieren, und repair malformed JSON
Nehmen ein JSON Zeichenkette (possibly minified, mit trailing commas, oder comments) und produce gültig, indented JSON mit Fehler diagnostics.
- 1
JSON from APIs is often minified for transport, and JSON from humans often has errors (trailing commas, single quotes, comments). Formatting makes it readable; validation catches structural errors before parsing fails in production.
- 2 JSON-Validator →
Paste the JSON. The tool reports whether it is valid and, if not, the exact location and nature of the syntax error (unexpected token, missing comma, unterminated string).
- 3 JSON-Formatierer →
Paste valid (or valid-ish) JSON to re-indent it with 2 spaces, sort keys if desired, and normalize whitespace for consistent diffs.
- 4 json-format → crc32
Use the chain to validate-then-format in one pass: if validation fails you get the error; if it passes you get formatted output.
Häufige Fragen
- Why does my JSON with comments fail validation?
- Standard JSON (RFC 8259) does not allow comments. Some parsers (JSON5, JSONC used by VS Code) accept them, but strict JSON does not. Strip comments before sending to a strict parser, or use a JSONC-aware parser.
- Can the tool fix trailing commas automatically?
- Strict JSON forbids trailing commas. The validator flags them; some formatters can strip them during formatting. However, automatic repair can mask real errors — always review the diff after any auto-fix.