JSON formatter: check syntax, preserve literals and explore a tree
Admin ·
A JSON formatter should make data easier to inspect without silently replacing large number digits or discarding duplicate properties. ToolMellow formats or minifies strict JSON, keeps source literal spellings, offers recursive object-key sorting and provides a searchable tree when its outline limits allow.
Use this guide to choose an action, diagnose syntax errors, inspect paths and export the complete result. It explains what preserved text does and does not guarantee, why duplicate pointers are ambiguous, and how input, file, tree and history limits differ. Processing is local; no account is needed.
Format or minify the whole input
Paste a JSON document into Input, open a local text file, or choose Try an example. Keep original order is the default for object keys. Choose two or four spaces, then press Format JSON for readable indentation or Minify for compact text. Both actions check syntax before producing a separate, read-only Result; highlighting part of Input does not restrict the operation.
Editing the input or changing indentation or key order clears the previous result and closes its tree. Run the action again after changing a setting. Wrap lines changes how the editors display long lines, without adding line breaks to the JSON. Interface language changes the controls, not the keys or values in your data; this workspace has no separate text-language selector.
- Keep a copy of the original document before editing.
- Use Format JSON for readable whitespace, or Minify to remove whitespace outside tokens.
- Keep original order unless you deliberately want recursive object-key sorting.
- Read syntax errors and duplicate-key warnings before using the result.
- Open Explore JSON tree when an outline is available; tree search and input replacement are different controls.
- Copy or download the whole result, then check it in the application that will consume it.
Microsoft jsonc-parser: token offsets, parse errors and formatting edits
Strict JSON is different from a JavaScript object
The input must contain one complete JSON value. An object or array is common, but a string, number, boolean or null can also be the entire document. Object names and string values need double quotes. JSON syntax checking does not establish that required fields, business rules or a JSON Schema are satisfied.
This formatter rejects comments, trailing commas and extra content rather than repairing them. A JavaScript object literal, JSON5 document or several JSON Lines records needs an appropriate conversion before it can be processed here. Fix the source deliberately; removing punctuation or comments blindly can change the intended data.
| Input example | Accepted here? | Meaning |
|---|---|---|
{"ready":true} | Yes | A JSON object with a quoted name and boolean value. |
[3,2,1] | Yes | An array; its element order is retained. |
"hello", 42, true, null | Yes | Any one of these can be a complete top-level value. |
| An empty or whitespace-only editor | No | There is no JSON value. |
{"a":1,} or [1,] | No | Trailing commas are rejected. |
{/* note */"a":1} | No | Comments are rejected. |
{a:1}, {'a':1}, NaN, Infinity | No | These are not accepted strict JSON syntax. |
{"a":1}
{"a":2} | No | Two separate records are not one JSON document. |
RFC8259: JSON grammar, interoperability and security considerations
Use the first error location to repair the source
If parsing fails, Result remains empty and the workspace reports the first error with a line, column and reason. Locations start at one; the column counts UTF-16 code units before the reported position, rather than screen cells or user-perceived characters. A missing value in {
"a": } is reported at line 2, column 8.
Inspect the reported token and the punctuation before it, make one correction, then run Format JSON or Minify again. Another error may appear after the first is fixed. The tool reports syntax problems; it does not insert missing values, guess your intended structure, list every error at once or validate a schema.
Microsoft jsonc-parser: token offsets, parse errors and formatting edits
Keep large numbers and string spellings intact
The result is assembled from original tokens and whitespace edits, rather than by serializing parsed JavaScript number values. Large integer digits, exponent spelling, trailing fractional zeros, negative zero and string escape spellings are retained. Formatting changes whitespace outside the tokens; Minify removes it. Literal spaces inside a string remain part of that string.
Preserved spelling is not a guarantee about another program’s numeric precision or range. For example, a receiver using ordinary JavaScript numbers may not retain every integer beyond its exact-integer range, and 1e400 can exceed a receiver’s finite numeric range. Choose a representation that your receiving system supports. The formatter does not automatically turn large numbers into strings.
| Source token or property | What remains in Result | What this does not promise |
|---|---|---|
9007199254740993 | The original digits. | Exact numeric handling by every downstream consumer. |
1e400 | The original exponent token. | A finite value in a receiver using binary64 numbers. |
1e+09 and 1.2300 | Their exponent and fractional spelling. | A single normalized representation. |
-0 | The minus sign and zero. | That another serializer will keep the same spelling. |
"\u0061" | The original escaped string spelling. | That decoded-value tree search searches the escape text. |
"a":1,"\u0061":2 | Both properties and their spellings. | Unique decoded names or unique pointers. |
RFC8259: JSON grammar, interoperability and security considerationsECMAScript: JSON.parse and JavaScript value conversion
Duplicate keys remain visible and need a decision
Repeated decoded names within the same object produce a duplicate-key warning. The formatter preserves every property instead of discarding earlier values. Consequently, "a" and "\u0061" count as the same decoded name even though their source spellings differ. Identical names in different objects are not duplicates of each other for this warning.
A successful result with this warning is not an automatic repair. Receivers can handle duplicate names differently, including keeping only a later value. Review which property you intended before using the data. The tree keeps duplicate properties as separate rows, but their copied pointers can still be identical.
RFC8259: JSON grammar, interoperability and security considerations
Choose object-key order without sorting arrays
Keep original order retains each object’s property sequence. Ascending and Descending recursively compare decoded object keys in UTF-16 string order. This is neither locale-aware alphabetical sorting nor natural numeric sorting: ascending places the key "10" before "2", and case can affect the order. Escaped and literal spellings with the same decoded name compare equally.
Nested objects are sorted too, including objects inside arrays. Array elements remain in their original sequence, and properties with equal decoded names retain their relative order. Values and raw literal spellings remain intact. Sorting changes the output bytes and does not turn the result into a general canonical serialization or a format for cryptographic signing.
Explore a bounded tree while keeping the full text result
After successful processing, choose Explore JSON tree when the outline is available. The root opens initially; nested containers start collapsed. Expand or collapse a branch to inspect its children. A branch initially shows up to 100 children, with a Show next control for another batch. A property label identifies a key; an array label identifies a zero-based index.
Number and string leaf literals display their original spellings, including large numbers and escapes. Container summaries show their child counts. Hide JSON tree returns to the text-focused view without changing the result. Reset tree clears its search and restores the initial branch state. Editing input clears the previous result and closes its tree. Processing again also closes the tree and supplies a new result if it succeeds.
Copy paths carefully, especially with duplicate names
Copy pointer copies a JSON Pointer path for a displayed node. The root has the display label $, but its actual pointer is the empty string. Child levels are separated by /; a literal tilde in a key becomes ~0, and a literal slash becomes ~1. Array indexes begin at zero. These strings are pointers, not JSONPath expressions.
A duplicate decoded key produces the same pointer for more than one row. Under JSON Pointer’s rules, evaluation of a nonunique member name is undefined and fails; copying that path does not uniquely identify a duplicate occurrence. This tool displays and copies paths rather than evaluating them. If clipboard access is unavailable, copy a non-root displayed path manually. For the root pointer, use an empty string rather than copying the visible root placeholder.
| Node or key | Pointer example | How to read it |
|---|---|---|
| The document root | Empty string, shown as "" here | Copy pointer copies zero characters, not $ or quotation marks. |
Object key name at the root | /name | One object-member level. |
Object key a/b~c at the root | /a~1b~0c | Slash and tilde inside the name are escaped. |
| First element under that array key | /a~1b~0c/0 | The final zero is an array index. |
Two root properties decoding to a | /a for both | The pointer is ambiguous for the duplicate name. |
Search decoded values and paths without editing the JSON
The tree search checks key labels, pointer paths and leaf values with a case-insensitive substring match using the interface locale. String values are decoded for searching, while numbers and other leaf literals use their original text. Thus a string displayed as "\u0061" can match the search a; searching for the escape spelling is a different operation. The source JSON is not changed by tree search.
The query field accepts up to 1,000 UTF-16 code units. The count covers matching nodes throughout the available outline, while the list displays only the first 100 matches. Refine a broad query rather than assuming the visible list contains every hit. Search-result containers can have their own child controls. Reset tree clears the query. This is a text search, not JSONPath or a structural query evaluator.
Keep input, file and tree limits separate
Input length is limited to 1,000,000 UTF-16 code units, inclusive. This is not a byte count or a count of user-perceived characters: one Unicode code point outside the basic multilingual plane uses two code units, and an emoji sequence can use more. The separate nesting limit is 256. These limits define accepted bounds; they do not guarantee that every document within them will finish quickly on every device.
The optional outline has its own limits. Its syntax-node count includes parser property and key nodes, not just visible tree rows; an object with one scalar property already has four syntax nodes. Repeated long key names and deep paths can also exhaust the outline’s character budget. When only an outline budget is exceeded, the complete formatted text remains available with a warning, although other processing limits still apply.
| Boundary | Current rule | Practical consequence |
|---|---|---|
| Input and decoded imported text | At most 1,000,000 UTF-16 code units. | Exactly the limit is allowed; split longer input. |
| Local file bytes | Strictly fewer than 4,000,000 bytes. | A file of exactly 4,000,000 bytes is refused. |
| JSON nesting | At most 256 nested containers. | Deeper JSON is rejected before formatting. |
| Outline syntax nodes | At most 10,000 parser syntax nodes. | This is not a 10,000-property allowance. |
| Outline text budget | At most 2,000,000 accumulated UTF-16 units of labels, paths and leaf literals. | The tree may be omitted while Result remains complete. |
| Visible children per branch | Initially 100, then batches of up to 100. | Use Show next to reveal more children. |
| Tree search | Query up to 1,000 UTF-16 units; first 100 matching nodes displayed. | The total match count can exceed the displayed list. |
| Input undo history | Up to 20 older snapshots and 4,000,000 combined past/future UTF-16 units, excluding current input. | Older history can be discarded; this is not durable storage. |
Open a local UTF-8 text file
Open text file reads a local file as UTF-8 text. First the file must be smaller than 4,000,000 bytes; then its decoded text must fit the input limit. UTF-8 bytes and UTF-16 code units are separate measures, and both checks are applied. The picker offers text-oriented file types, but a filename extension is not evidence that the contents are valid JSON.
Import places literal text into Input rather than executing markup, fetching a URL or interpreting a PDF or Word document. It does not offer an encoding detector or another decoding choice. Review the decoded characters, then run Format JSON or Minify. An accepted import participates in input history; a refused file leaves the existing input available.
Copy, download or reuse the complete result
Copy result copies all generated text, regardless of the current editor selection or tree search. If clipboard access is unavailable, select and copy the result manually. Download writes the full result as UTF-8 text named toolmellow-result.json. It exports the generated text, not your original file bytes, a screenshot or only the currently visible tree nodes.
Pretty indentation can make the result longer than the permitted input. Copy and Download can still export that complete result. Use result as input checks the input cap separately and refuses a result above 1,000,000 UTF-16 units while preserving both editors. When reuse is allowed, it replaces Input and clears the old result; Undo can restore the earlier input within the available history.
Use literal input replacement and bounded Undo
Find & replace in input is independent of tree search. It finds literal text throughout Input, with an optional Match case setting; the default is case-insensitive. Punctuation such as . is ordinary search text, and replacement dollars such as $& are inserted literally. Find text allows 1,000 UTF-16 units and Replace with allows 10,000. Replace all refuses a replacement that would exceed the input cap.
Accepted edits, imports, replacements and result reuse participate in the bounded input history. Undo and Redo restore input snapshots and clear the old result; typing can be grouped into one step. Native paste checks the prospective length after subtracting the selected range and normalizing CRLF or CR to LF, refusing an oversized paste as a whole. Neither search is a schema-aware rename: replacing characters can break JSON or change values, so process the edited input again.
Understand Clear, cancellation and local processing
Clear removes input, result, input history, search and replacement fields, and closes the tree. It retains settings such as indentation, object-key order and wrapping. Clear cannot be undone. Text and results stay in this tab’s memory without durable autosave; keep an exported copy before leaving or refreshing.
Processing runs in a local worker. While a manual operation is pending, Cancel stops that operation and keeps the original input. Input or option changes also invalidate stale work. The worker has a 60-second processing deadline including startup, but that is an implementation limit rather than a promise that every supported input will finish; use a smaller document if processing cannot finish.
The JSON content is processed as data, and tree strings or URLs are displayed as text rather than executed or fetched. The page and engine assets can still make network requests. Local processing is not JSON Schema validation, secret redaction or a security verdict about the contents; copying or downloading data gives you the same responsibility to review where it goes.
Check the receiving system before using the result
Choose readable formatting for inspection and compact text when whitespace size matters. Keep original order when property sequence is useful for review; choose sorting deliberately. With original key order, formatting uses the first actual line-ending style in the processed source, with LF as the fallback. Sorting reconstructs compact source first, so subsequent pretty formatting uses LF. Outer whitespace is trimmed. Browser text controls can normalize line endings, so this is not an original-file byte preservation tool.
Before using a configuration or API payload, resolve duplicate-name warnings, check large-number requirements and validate any required schema in the receiving system. Use the text result when the optional tree is unavailable. Treat copied duplicate-key pointers as ambiguous, and save your result before Clear or navigation. Syntax success means the formatter accepted the JSON text; it does not certify that another application will accept its meaning.
RFC8259: JSON grammar, interoperability and security considerationsRFC6901: JSON Pointer syntax and evaluation
Common questions
Are large integers and number spellings preserved?
The original number tokens are retained in Result and tree literals, including large digits, exponent spelling and negative zero. This does not guarantee precision or range in the receiving application. The formatter does not automatically quote large numbers or normalize their representation.
What happens to duplicate object keys?
All properties are retained and a warning counts repeated decoded names within each object. Literal "a" and escaped "\u0061" are the same decoded name. Resolve unintended duplicates yourself; receivers may retain only a later value or handle them differently.
Why do duplicate keys have the same JSON pointer?
Paths use decoded member names, so duplicate names create identical paths. A copied pointer cannot uniquely select a duplicate occurrence. RFC6901 makes evaluation of a nonunique member undefined and failing; this tool only displays and copies paths.
Does this accept comments, trailing commas, or JSON Lines?
No. Comments, trailing commas and extra records are rejected. Each operation needs one complete strict JSON value. This is not a JSON5, JSONC or NDJSON conversion or repair tool.
Can a JSON document contain just a string, number, boolean, or null?
Yes. A single string, number, true, false or null can be a complete JSON document, as can an object or array. Empty or whitespace-only input has no JSON value.
Does sorting object keys change array order?
No. Sorting recursively changes object-property order using decoded-key UTF-16 comparison. Arrays retain their element order, including when objects inside them are sorted; equal decoded keys retain their relative order.
Why is the JSON tree unavailable while formatting succeeds?
The outline is limited to 10,000 syntax nodes and a separate 2,000,000-unit UTF-16 budget for labels, paths and leaf literals. Property and key syntax nodes count too. Exceeding an outline budget can remove the tree while keeping the complete text result and a warning.
What input, file, and tree limits apply?
Input and decoded imports allow at most 1,000,000 UTF-16 units; local files must be strictly smaller than 4,000,000 bytes. Nesting is limited to 256. The tree has separate node/text budgets and child/search display limits. These bounds do not guarantee completion or speed for every device.
Does formatting upload, execute, or save my JSON?
JSON processing runs locally in a worker and displays data as text. Page and engine assets can still load over the network. There is no durable autosave; Clear discards text and history. The formatter does not run JSON as code, redact secrets or certify its safety for another system.
Does a successful format validate a JSON Schema?
No. Success checks accepted JSON syntax. It does not verify required fields, application types, cross-field rules or a JSON Schema. Validate those requirements separately in the receiving system.
Does selecting part of Input format only that selection?
No. Format JSON and Minify process the whole input. Copy result and Download export the whole generated result too. Tree search changes the displayed search list, not the output text.
What does the root JSON pointer copy?
It copies the empty string. The visible root label $ is not the pointer value. A child path uses / between levels, ~0 for a tilde in a key, ~1 for a slash, and zero-based indexes for array elements.
Why can I download a result that cannot be reused as input?
Pretty formatting can expand the output beyond the separate 1,000,000-unit input limit. Full Copy and Download remain available, while Use result as input refuses an oversized result and preserves both input and output. Export it or process smaller sections instead.
Can I recover text after Clear or a refresh?
Clear removes the input history and cannot be undone. The workspace has no durable autosave or refresh recovery. Save a copy with Copy result or Download before clearing or leaving the tab.
Primary references
Put it into practice.
Related guides
- How to Format HTML Code for Readability
- How to Minify or Beautify CSS
- How to Remove Duplicate Lines and Sort Text
- How to Generate a SHA-256 Hash of Text
- How to Encode and Decode Base64 Text (UTF-8)
- How to URL Encode and Decode Text
- How to Generate a UUID: v4, v7 and GUIDs
- How to Decode a JWT and Read Its Claims
- How to Convert a Unix Timestamp to a Date
- How to Generate Lorem Ipsum Placeholder Text