toolember

Developer

JSON Formatter & Validator Online

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.

JSON Input
Output, Beautify
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.

Frequently Asked Questions

What does the JSON formatter do?
The JSON formatter parses your JSON and re-serializes it with your chosen indentation (2 spaces, 4 spaces, or a tab character), making nested objects and arrays easy to read. It validates your JSON in the process, if the input is invalid, the error shows the exact line number and column so you can jump straight to the problem.
What is the difference between Beautify and Minify?
Beautify (Format) adds newlines and spaces to make JSON human-readable. Minify does the opposite, it strips all unnecessary whitespace to produce the smallest valid JSON string, which is useful for API payloads, cookies, or reducing file size in production.
How do I validate JSON and see the exact error location?
Just paste your JSON, validation is instant and reactive. If the JSON is invalid, the header bar above the input turns red and shows the specific error with line number and column (e.g. "Unexpected token }, line 4, col 3"). No button click needed. This makes it faster than tools that require you to click Validate.
Is my JSON data sent to a server?
No. All formatting, minifying, sorting, validating, and conversion runs entirely in your browser using the built-in JavaScript JSON engine. Your data never leaves your device, there are no API calls, no server logs, and no analytics on the content of your JSON.
How do I sort JSON keys alphabetically?
With valid JSON in the input, select A→Z or Z→A with the direction toggle, then click "Sort keys". The tool recursively reorders every object's keys at every depth. The sorted result replaces your input so you can continue editing or copy it out.
What JSON conversion formats are supported?
The tool converts JSON to YAML, CSV, and XML. CSV conversion requires the input to be a JSON array of objects (each object becomes a row). YAML and XML work on any valid JSON. Use the Escape mode to turn any text into a safe JSON string value, and Unescape to decode it back.
What is JSON escaping and when do I need it?
JSON string values must escape certain characters: double quotes become \", backslashes become \\, newlines become \n, and so on. Use the Escape mode when you need to embed a block of text (code, HTML, a file path) as a JSON string value. Use Unescape to decode a previously escaped string back to readable text.
What JSON is supported?
Standard JSON as defined by RFC 8259: quoted string keys, and values of type string, number, boolean, null, object, or array. Comments and trailing commas (common in JSON5 or JSONC) are not supported by the standard parser and will produce a validation error. Large files up to several megabytes work fine, there is no artificial size limit.