JSON Formatter & Validator

Validate, format and minify JSON locally while preserving number literal spelling and member order. Choose indentation or compact output; invalid JSON shows an error banner.

Loading tool module...

About this json formatter & validator

Validate, format and minify JSON locally while preserving number literal spelling and member order. Choose indentation or compact output; invalid JSON shows an error banner.

How this tool works

JSON syntax is checked before any output is produced. Formatting then changes only whitespace outside string tokens: number literals, decimal and exponent notation, escaped strings, duplicate member names and member order remain as written. Minification removes only JSON whitespace outside strings.

  1. Paste the example into Input JSON text.
  2. Choose 2 spaces and click Safe Format.
  3. Compare the output, then click Minify to recover the compact input.

Worked example

Scenario: The page offers formatting with 1, 2 or 4 spaces and minification. The example is a JSON object containing the integer 9007199254740993 and a string containing an escaped underscore. Use Safe Format with 2 spaces to obtain the displayed output; Minify returns the compact input without changing either value.

Sample input:

{"id":9007199254740993,"text":"\u005f_CZOA_BIGINT_0__"}

Processing: JSON syntax is checked before any output is produced. Formatting then changes only whitespace outside string tokens: number literals, decimal and exponent notation, escaped strings, duplicate member names and member order remain as written. Minification removes only JSON whitespace outside strings.

Illustrative output:

{ "id": 9007199254740993, "text": "\u005f_CZOA_BIGINT_0__" }

Limits and verification

Comments, trailing commas, invalid escapes, leading-zero numbers and truncated JSON are rejected. Empty input clears the result; it is not valid JSON. Duplicate keys are preserved, but receivers may interpret them differently. Preserving a large number literal does not make a downstream floating-point parser exact. Processing is synchronous and large inputs can exhaust tab memory. Clipboard access depends on browser permission; invalid input cannot be copied or downloaded as a result.

Examples demonstrate an expected workflow; they do not prove every input or every branch of an external specification. Check important results with an independent source before using them for money, security, compliance, safety, or irreversible file changes.

Browser processing boundary

Tool input is processed by code running in the browser and is not intentionally sent to a CZOA processing API. The page can still request ordinary site assets, analytics, or advertising when those services are enabled. Browser extensions and managed-device software remain outside this tool's control.

Relevant references

These references govern or help explain the format, protocol, or calculation used here. Listing a reference does not claim certification or complete implementation of every optional feature.

Content owner: CZOA Tools · Review methodology

How to use it

  1. Paste the example into Input JSON text.
  2. Choose 2 spaces and click Safe Format.
  3. Compare the output, then click Minify to recover the compact input.

Frequently asked questions

What does Safe Format do to {"b":2,"a":1}?+

Enter that text, choose 2 spaces, and press Safe Format. The browser emits an indented object with b before a; it does not alphabetize this input.

When should I use Minify instead of Safe Format?+

Safe Format writes line breaks and the selected indentation. Minify removes JSON whitespace outside strings, so choose it when compact transport text matters rather than readable lines.

Why can valid-looking text still fail here?+

The editor accepts JSON text, not comments, trailing commas, or incomplete literals. It also rejects malformed Unicode before processing, so repair the source text instead of treating the output area as a validator bypass.

Does JSON Formatter change the meaning of an embedded script string?+

No schema check or sanitization is performed. A JSON string containing markup remains a string; formatting runs in the tab, while ordinary page-resource requests are separate from that text operation.