Boneyard Tools

JSON Formatter and Validator

The JSON formatter pretty-prints, validates and minifies JSON in one place. Paste a blob to indent it for reading, strip it down for shipping, or sort keys for clean diffs, and get an instant valid or invalid check with a line and column hint when something is off. Everything runs in your browser, so even sensitive payloads stay on your machine.

How to format JSON

  1. Paste your JSON into the editor, or click 'Load sample' to try it.
  2. Choose 'pretty' to indent or 'minify' to strip whitespace.
  3. In pretty mode, set the indent to 2 or 4 spaces.
  4. Toggle 'Sort keys' to order keys alphabetically at every level.
  5. Check the valid or invalid indicator, then Copy or Download the result.

Examples

Pretty-print

{"name":"Ada","skills":["math","logic"]}
{
  "name": "Ada",
  "skills": [
    "math",
    "logic"
  ]
}

Minify

{
  "a": 1,
  "b": 2
}
{"a":1,"b":2}

Sort keys

{"b":1,"a":2}
{
  "a": 2,
  "b": 1
}

Frequently asked questions

Does this validate JSON too?

Yes. As you type, the tool parses the input and shows a green 'Valid JSON' badge or the parser's error message. When the position is known it adds a line and column hint so you can jump straight to the problem.

Is my JSON sent to a server?

No. Formatting, validation and minifying all happen locally in your browser using the built-in JSON parser, so your data never leaves your device. That makes it safe for API responses and configs that contain secrets.

What is the difference between pretty and minify?

Pretty mode indents the JSON across multiple lines so people can read and review it. Minify removes every optional space and newline to produce the smallest valid string, which is what you want for storage or sending over the wire.

Can I sort object keys?

Yes. Turn on 'Sort keys' to order keys alphabetically at every nesting level. Array element order is always preserved, since order is meaningful in arrays. Sorting keys makes two versions of the same object diff cleanly.

What indentation can I use?

Two or four spaces in pretty mode, whichever your team prefers. In minify mode the indent setting is disabled because all whitespace is stripped.

How does the line and column hint work?

When the parser reports a character position for the error, the tool counts newlines up to that point to translate it into a line and column. That points you at the exact bracket, comma or quote that broke parsing.

Will formatting change my numbers?

It reformats whitespace and, if you ask, key order, but parsing does normalize numbers. A value like 1.0 becomes 1 and a very large integer beyond safe precision may lose exactness, because JSON numbers are read as standard doubles.

Does it accept comments or trailing commas?

No. This is a strict JSON formatter, so comments, single quotes and trailing commas are reported as errors. Those belong to JSON5 or JavaScript object literals, not to the JSON specification.

Can it handle large files?

Yes, within your device memory. Because it runs in the browser, very large documents depend on available RAM, but typical API payloads format instantly.

Learn more

Related tools