Local browser utility · Examples and limits included

JSON Formatter

Use this free JSON formatter to pretty-print, minify, and validate JSON with configurable indentation and clear parse errors.

Your JSON is processed locally in your browser. We don't store or send your data anywhere.

0 characters

ResultPaste JSON above, then choose Format, Minify, or Validate.

Your formatted JSON will appear here.

Formatting re-serializes the parsed value, so comments and trailing commas are dropped and key order is preserved as JSON.parse returned it.

What the result contains

What This Tool Provides

Parse JSON with the browser’s standards-based parser, then pretty-print it with 2 spaces, 4 spaces, or tabs, minify it, or validate it without changing the input field. Syntax errors are shown as text and include line and column information when the parser provides an offset.

  • Formatted JSON with selectable indentation
  • Whitespace-minified JSON
  • A clear valid/invalid result
  • Parser error text with a location when available

How to Use This Tool

  1. Paste JSONAdd an API payload, fixture, or configuration value to the input area.
  2. Choose the operationFormat, minify, or validate; indentation applies to formatting.
  3. Fix or copyCorrect the first reported syntax error or copy the text output.

How It Works

JSON.parse validates and converts the input into a JavaScript data value. JSON.stringify then serializes that value with the selected indentation or without optional whitespace. No eval or code execution is used, so strings containing HTML or JavaScript remain data.

Worked Examples

Pretty-print an object

Input
{"a":1,"b":[2,3]}
Output
{ "a": 1, "b": [ 2, 3 ] }

Whitespace and line breaks change, but the parsed object and array values do not.

Reject a trailing comma

Input
{"a":1,}
Output
Invalid JSON

Standard JSON does not allow a comma after the final property.

What Valid JSON Can Contain

JSON values and common JavaScript-only syntax
ItemJSON statusExample
Object, array, string, numberAllowed{"items":[1,"two"]}
Boolean and nullAllowed{"ready":true,"value":null}
Single-quoted stringNot allowed{'name':'Ada'}
Trailing commaNot allowed{"a":1,}
Comment or undefinedNot allowed{"a":undefined} // note
Unquoted keyNot allowed{a:1}

Formatting Is Not Validation Against a Schema

Successful parsing proves that the text follows JSON syntax. It does not prove that required application fields exist, that values have the expected types, or that an API will accept the payload. Those rules require a separate schema or application validator.

When the JSON Will Not Parse Yet

Plenty of payloads are not JSON at the moment you paste them. A JWT is three Base64url segments separated by dots, so the middle segment has to be decoded from Base64 before there is any object to format — paste the whole token here and it will simply fail as a syntax error. JSON pulled out of a query string or a redirect URL arrives percent-escaped, where every quote shows up as %22, and it needs decoding from percent-encoding first.

Once it parses, the fields most likely to confuse you are the timestamps: created_at, exp and iat are almost always epoch seconds, which you can convert to a readable date to check whether a token expired or a record is as recent as you assumed. When two API responses should match but do not, formatting both and running a line-by-line diff of the two payloads locates the changed field far faster than reading them side by side.

Important Edge Cases

  • Duplicate object keys are accepted by JSON.parse and later values replace earlier ones.
  • Very large integers can lose precision when represented as JavaScript numbers.
  • A parser may word the same syntax error differently in Chrome, Safari, and Firefox.

Limitations

  • Comments, trailing commas, functions, undefined, and single-quoted strings are not JSON.
  • The formatter does not sort keys or validate a JSON Schema.
  • Input above 5,000,000 characters is rejected; deeply nested input below that limit can still use noticeable browser time and memory.

Input handling

Private Browser Processing

The JSON is parsed locally and is not sent to Tiny Tiny Tools. Normal page analytics does not receive the pasted payload.

Google Analytics records page visits and whether a tool finished or failed, but these tool implementations do not send field values, generated passwords, QR payloads, uploaded QR images, or camera frames to analytics or a Tiny Tiny Tools processing endpoint.

Safety note: Avoid pasting production API keys, authentication tokens, private keys, or customer records unless necessary, even when using a local tool.

See the Privacy Policy for site-wide details.

Questions About This Tool

Does formatting change JSON values?

It parses and re-serializes the data, changing whitespace only. Duplicate keys and number precision are important exceptions to understand.

Why are comments rejected?

Comments are JavaScript syntax, not part of the JSON data format.

Does valid JSON mean my API will accept it?

No. Syntax can be valid while required fields, types, or business rules are wrong.

Can pasted code execute?

No. The tool uses JSON.parse and renders output with textContent rather than evaluating or injecting the input as HTML.