How to use the JSON formatter
Paste a complete JSON value, then choose the operation that matches your task. Formatting and minifying both parse the document first, so malformed input is never silently rewritten. Validation leaves the original text unchanged and reports whether the syntax is acceptable.
- Paste an object, array, string, number, boolean or null value that follows JSON grammar.
- Choose two-space or four-space formatting for readable output, or choose Minify for a compact representation.
- Use Validate when you only need a syntax check. If parsing fails, inspect the reported line and column near the first detected problem.
- Review any large-integer warning before copying the result, especially when identifiers or financial values must remain exact.
Examples and expected behavior
| Input | Output | Notes |
|---|---|---|
{"name":"Ada","active":true} |
{
"name": "Ada",
"active": true
} |
A small object becomes consistently indented and easier to review. |
[1,2,{"ok":false}] |
[1,2,{"ok":false}] |
Minify removes insignificant whitespace but preserves values and array order. |
{"message":"你好 👋"} |
Valid JSON |
JSON strings are Unicode. Emoji and non-Latin text do not require special handling. |
{"a":1,} |
Error near the trailing comma |
JSON does not permit trailing commas after the last object member or array item. |
{"id":9007199254740993} |
Formatted output plus a precision warning |
The token is syntactically valid, but JavaScript numbers cannot represent it exactly. |
{"code":"alert(1)"} |
A normal string value |
Text that resembles code remains data. This tool never calls eval or Function. |
Accepted input and JSON grammar
A JSON document contains exactly one top-level value. That value may be an object, array, string, number, true, false or null. Object property names must use double quotes. Strings also use double quotes and must escape embedded quotation marks, backslashes and control characters. Comments, single-quoted strings, undefined, NaN, Infinity, hexadecimal literals and trailing commas belong to JavaScript or other formats, not standard JSON.
Whitespace is allowed between tokens, so spaces, tabs and line breaks can make a document readable without changing its meaning. The formatter normalizes that insignificant whitespace while preserving property insertion order as returned by the browser parser. It does not sort keys, infer types, rename properties or alter string contents. A byte-order mark or unrelated text before or after the top-level value should be removed before validation.
- Use UTF-8 text when moving JSON between systems.
- Escape literal line breaks inside strings as \n rather than inserting a raw newline.
- Remember that duplicate object keys are legal to some parsers but ambiguous; the last value usually wins in JavaScript.
Formatting, minifying and validation behavior
Formatting parses the input and serializes the resulting value with either two or four spaces per nesting level. Minifying performs the same parse but emits no unnecessary spaces or line breaks. Because both operations serialize a parsed value, they can expose semantic issues such as duplicate keys or numbers that were rounded by the JavaScript number model. They are not lossless text transformations in the way a source-code formatter can be.
Validation performs the same standards-based parse and reports the first error the browser exposes. The tool converts the parser position into a one-based line and column so you can inspect the nearby comma, quote, bracket or value. One syntax error can cause later text to look incorrect, so fix the earliest reported location first and validate again. The position is a diagnostic aid, not a formal recovery parser.
- Formatting does not repair invalid JSON automatically.
- Minifying does not encrypt, compress with gzip or hide sensitive fields.
- Validation checks syntax, not a business schema or required-property rules.
Large integers and numeric precision
JSON itself does not impose JavaScript’s 53-bit integer precision limit, but this browser implementation parses numbers into IEEE 754 double-precision values. Integers larger than 9,007,199,254,740,991 or smaller than -9,007,199,254,740,991 may be rounded even though the JSON syntax is valid. The tool scans integer tokens and displays a warning before you rely on the serialized output.
For database IDs, account numbers, nanosecond timestamps, cryptographic counters or exact monetary minor units, represent the value as a quoted string unless every receiving system supports an arbitrary-precision JSON number strategy. The formatter does not invent a BigInt representation because BigInt is not a JSON data type and JSON.stringify cannot serialize it directly. Treat the warning as a request to confirm the data contract, not as proof that a particular downstream parser will fail.
- Safe integer: 9007199254740991.
- Unsafe integer example: 9007199254740993.
- Decimal fractions also use binary floating-point and may have familiar rounding behavior such as 0.1 + 0.2.
Common uses and workflow choices
Developers commonly format API responses, configuration fragments, browser storage exports, log payloads and webhook samples before reviewing them. Minified JSON is useful when comparing payload size, embedding a small fixture or removing presentation whitespace before transport. Validation is useful in support conversations where you need to distinguish malformed syntax from a server-side schema or authorization error.
Use the operation that answers the immediate question. If a service rejects a document, validate syntax first, then compare the property names and value types against the service schema. If a diff is noisy, format both documents with the same indentation before comparing them. If the document contains secrets, redact them before sharing even though this page processes locally.
- Review copied API examples without installing an editor extension.
- Normalize test fixtures before committing them.
- Check generated JSON from scripts, templates or low-code tools.
- Inspect Unicode escaping and nested arrays during debugging.
Errors, boundaries and non-goals
Typical errors include missing commas, extra commas, unclosed strings, invalid escape sequences, mismatched brackets and property names without double quotes. An empty input is reported separately. Extremely deep documents may still exhaust browser memory or the JavaScript call stack during serialization, and very large documents can make the page temporarily unresponsive because the work occurs in the current browser context.
This is not a JSON Schema validator, JSONPath evaluator, query engine, canonical JSON implementation or streaming parser. It does not preserve comments because standard JSON has none, and it cannot preserve the original spelling of numbers after parsing. It also does not guarantee stable key ordering across unrelated producers. For signed payloads, hashes or byte-for-byte comparisons, operate on the exact original bytes required by the protocol instead of reformatting first.
- Do not use formatted output as a canonical signature input unless the protocol explicitly defines that serialization.
- A successful parse does not mean URLs, dates or identifiers inside strings are valid.
- Browser memory, not a server upload limit, determines the practical maximum size.
Security and privacy considerations
The formatter uses JSON.parse and JSON.stringify. It does not use eval, new Function, dynamic script insertion or template execution. A string containing HTML, JavaScript or shell syntax is treated as ordinary text. The page does not intentionally upload the input, and this batch does not store it in localStorage, session storage, IndexedDB or a conversion history.
Local processing reduces exposure but does not make an untrusted document harmless in every later context. Copying a string into HTML, SQL, a shell command or a spreadsheet still requires the escaping rules for that destination. Also consider browser extensions, screen sharing, clipboard managers and device-level logging when handling secrets. Clear the fields and clipboard after working with credentials or regulated data.
- Redact tokens, passwords and personal data before sharing screenshots.
- Do not assume formatting sanitizes HTML or removes prototype-pollution keys.
- Use a dedicated schema validator when object structure is part of a security boundary.
How this differs from related tools
The JSON to YAML converter changes serialization formats and applies a restricted YAML schema; the formatter stays entirely within JSON. The JSON to CSV converter expects an array of records and flattens values according to an explicit nested-value policy. A Base64 encoder changes bytes into a transport alphabet but does not parse JSON, and a hash generator produces a one-way digest rather than readable structured output.
Choose this page when the problem is JSON readability or syntax. Choose JSON Schema tooling when you must enforce property types and required fields. Choose a diff viewer when you need semantic comparison between two documents. Choose a streaming command-line parser for multi-gigabyte files. Keeping these purposes separate avoids treating a successful format operation as validation of a broader data contract.