JSON Formatter & Validator Online
JSON (JavaScript Object Notation) is a lightweight, text-based format for exchanging structured data between systems, and this formatter helps you read, validate, and reshape it. Format and validate JSON instantly in your browser, no sign-up, nothing uploaded. Paste your JSON to beautify it with 2-space, 4-space, or tab indentation, minify it to a single line, or see a precise error with line and column number. Also converts to YAML, CSV, and XML, sorts keys alphabetically, and escapes or unescapes JSON strings.
Output appears here as you type…100% private, all processing runs in your browser. Your JSON is never uploaded or stored.
What each mode does
Beautify
Re-formats JSON with readable indentation. Choose 2 spaces (default), 4 spaces, or a tab character. Best for reading API responses or editing config files.
Minify
Strips all whitespace and newlines. Produces the smallest valid JSON string, use for production API payloads, cookies, or local storage values.
YAML
Converts JSON to YAML format. Useful when moving config between JSON-based tools (package.json, tsconfig) and YAML-based tools (GitHub Actions, Docker Compose).
CSV
Converts a JSON array of objects to comma-separated values. Each object becomes a row; keys become column headers. Ready to open in Excel or Google Sheets.
XML
Converts JSON to a well-formed XML document. Useful when integrating with SOAP services or XML-based systems that consume structured data.
Escape / Unescape
Escape turns any raw text into a safe JSON string value (quotes, backslashes, and control characters are encoded). Unescape decodes it back. Handy when embedding code or HTML inside a JSON field.
Sort keys
Reorders all keys inside every object alphabetically (A→Z or Z→A), recursively through the entire tree. Useful for diffing configs or normalising output.
Understanding JSON validation errors
The most common JSON syntax mistakes and how this tool pinpoints them:
Trailing comma
{"a": 1,}JSON does not allow a comma after the last item in an object or array. Remove the comma before } or ].
Single-quoted strings
{"key": 'value'}JSON requires double quotes (") for all string values and keys. Replace single quotes with double quotes.
Unquoted keys
{key: "value"}Unlike JavaScript objects, JSON requires keys to be double-quoted strings: {"key": "value"}.
Comments in JSON
{"a": 1 // comment}Standard JSON (RFC 8259) does not support comments. Remove them, or switch to JSON5 / JSONC if your parser supports it.
Undefined or NaN values
{"x": undefined}JSON has no undefined, NaN, or Infinity. Replace with null or a valid number string.
JSON parsing edge cases worth knowing
A few behaviors surprise developers even when the JSON itself is valid:
Duplicate keys
{"a": 1, "a": 2} is valid JSON per RFC 8259, the spec does not forbid repeated keys. In practice every mainstream parser, including the JavaScript engine this tool runs on, keeps the last value and silently drops the earlier one. If a payload looks shorter after formatting than you expected, check for a repeated key.
Large integers lose precision
JavaScript numbers are IEEE 754 doubles, which only represent integers exactly up to 2^53-1 (9007199254740991). A JSON number like a Snowflake ID or a 64-bit database key that exceeds that range can come out changed after formatting, since parsing round-trips through a JS number. If exact precision matters, keep IDs as JSON strings instead of raw numbers.
Key order is preserved, not guaranteed
The JSON spec treats objects as unordered key/value sets. This tool, like virtually every modern JS engine, preserves insertion order in practice, so Beautify and Minify will not reshuffle your keys. Sort keys is a separate, explicit action, nothing reorders your object unless you ask for it.
Unicode escapes
Characters outside the Basic Multilingual Plane (many emoji, some CJK extension characters) are encoded in JSON as a surrogate pair, e.g. "😀" for a face emoji. Beautify and Minify leave these escapes as-is rather than converting them to literal characters, since re-encoding is only cosmetic and both forms are equally valid JSON.
These behaviors follow RFC 8259, the official JSON data interchange format specification. The integer precision limit comes from JavaScript's Number.MAX_SAFE_INTEGER.
Frequently Asked Questions
What does the JSON formatter do?▾
What is the difference between Beautify and Minify?▾
How do I validate JSON and see the exact error location?▾
Is my JSON data sent to a server?▾
How do I sort JSON keys alphabetically?▾
What JSON conversion formats are supported?▾
What is JSON escaping and when do I need it?▾
What JSON is supported?▾
What happens to duplicate keys in a JSON object?▾
Why did a large number change after I formatted my JSON?▾
By Toolember · Updated September 2026