JSON Formatter
Format, minify, validate, or inspect strict JSON without changing valid data.
JSON needs attention
- Error code
- Position
Escaped nearby text
Private result receipt
- Operation
- Indentation
- Input size
- Output size
- Tokens
- Nodes
- Warnings
Interoperability warnings
Formatting stays lossless. These warnings identify data that other JSON parsers may interpret differently.
Ordered JSON outline
Object members stay in source order, including duplicate names.
Lossless JSON formatting
Format adds only indentation and LF line breaks. Minify removes only insignificant JSON whitespace. Both operations use an ordered lossless parser, so they preserve object-member order, duplicate members, exact number tokens such as 1.2300e+04, and exact valid string escapes such as \u0061. The tool never runs JSON through an object model that could silently replace a duplicate or round a number.
Validate checks the same strict grammar and returns a receipt without rewriting the source. Outline builds a read-only ordered tree; duplicate member names remain separate entries. All names and values are inserted as text, so JSON containing HTML or script-like strings is displayed rather than executed.
Duplicate names and number warnings
RFC 8259 says names within an object should be unique because software behavior is unpredictable when they are not. This formatter decodes member names for comparison, which means "a" and "\u0061" are recognized as the same name. Every source member remains in the formatted or minified result, while later occurrences receive a deterministic path and occurrence number.
JSON number grammar does not set one universal precision. Many programs use binary64, whose exactly interoperable integer range is −9,007,199,254,740,991 through 9,007,199,254,740,991. Risky integers, precision-heavy decimals, and out-of-range exponents receive warnings, but their original number lexemes are never changed. These warnings are focused interoperability checks; they are not a claim of full I-JSON validation.
Common strict JSON errors
| Input pattern | Why strict JSON rejects it | Valid direction |
|---|---|---|
{"a":1,} | Trailing comma | Remove the final comma |
{'a':1} | Single-quoted name | Use double quotes |
{"a":1 // note} | Comment | Remove the comment |
{"a":01} | Leading-zero number | Use 1 or a decimal fraction |
{"a" 1} | Missing colon | Add : after the name |
{"a":1 "b":2} | Missing comma | Separate members with , |
{"a":1,"a":2} | Valid grammar, risky duplicate name | Keep only intentional unique names |
Deterministic errors and resource limits
A failed run returns a stable error code, zero-based UTF-16 offset, one-based line and column, and an escaped nearby snippet capped at 80 code points. It does not copy the full input into the error panel. Browser exception wording is never used as the error contract, so the same source produces the same receipt across supported browsers.
Input is limited to 1,048,576 UTF-8 bytes, nesting to 128 levels, and parsing to 100,000 tokens. Formatted or minified output is limited to 2,097,152 UTF-8 bytes. The page displays at most 100 warnings and 20,000 outline nodes. Hitting the outline limit does not prevent using Format, Minify, or Validate on the same input.
Browser-only privacy and scope
The JSON engine runs entirely in this page after its static files load. It makes no application request, fetches no remote URL, reads no clipboard, and writes to the clipboard only when you choose Copy input or Copy result. Source, result, and settings remain in memory and are not placed in local storage, session storage, IndexedDB, cookies, query parameters, or URL fragments. With JavaScript disabled, this explanation and the strict JSON rules remain readable, but interactive formatting requires JavaScript.
This page does not repair JSON5 or JSONC, sort or canonicalize members, validate a JSON Schema, compare documents, convert XML, YAML, or CSV, generate code, upload or download files, fetch URLs, or save documents. Those are separate tasks with different data and trust boundaries.
Frequently asked questions
Does this formatter change JSON numbers or duplicate members?
No. Format and Minify change insignificant whitespace only. Number and string tokens keep their original spelling, object order stays intact, and duplicate members remain present with a warning.
Why does valid JSON show a duplicate-name warning?
RFC 8259 says object member names should be unique, but duplicate names are still accepted by its grammar. Programs disagree about which duplicate value to keep, so this tool preserves every member and identifies later occurrences.
Why is a large number marked as an interoperability risk?
Many JSON consumers use IEEE 754 binary64 numbers. Integers beyond ±9,007,199,254,740,991 and very large, tiny, or high-precision decimals may be rounded or rejected elsewhere. ToolNeko warns without rewriting the token.
Can it repair JSON5, comments, or trailing commas?
No. This page validates strict RFC 8259 JSON. It reports comments, single quotes, trailing commas, plus-prefixed numbers, NaN, Infinity, and leading-zero numbers as errors instead of guessing a repair.
Is my JSON uploaded or saved?
No. The formatter runs in your browser, keeps the current input and result in memory for this page lifetime, and does not store them in browser storage, the URL, cookies, a file, or a ToolNeko application request.