Preparing your generator page
We are loading content and tools so everything is ready to use.
We are loading content and tools so everything is ready to use.
Pretty-print JSON, minify it, or check that it parses. Both boxes open with a 6-line Muxgen sample, 113 characters, whose features array sits on one line. Format with the default 2 spaces expands that array and makes 10 lines. Minify makes one line of 94 characters. Validate copies the input only when JSON.parse succeeds. Nothing is uploaded.
More helpers are in Utility tools.
Last updated: October 8, 2026 · Published: 2026-04-09 · Updated: 2026-10-08
Output stats
Characters: 113
Lines: 6
Format and Minify read the left box with JSON.parse and write the right box with JSON.stringify. Format passes the indent. Minify passes no extra space. If Sort object keys is on, object keys are ordered with localeCompare before printing. Arrays are walked, and their order is kept.
Validate is only the parse. On success it puts the input text into the output, so the sample’s one-line array stays one line. On failure the red box shows the parser’s message and the previous output remains. The green line, “JSON looks valid,” is shown whenever no error is stored. It does not follow every keystroke, and it can remain after Clear.
A passing check means the text is JSON. It does not mean the text matches a schema, and it does not repair comments or trailing commas.
Four steps. The output changes when you click.
The Muxgen sample is already in both boxes. Replace it, or clear both boxes first.
Indent starts at 2 spaces and accepts 0 through 8. Sort object keys starts off.
Format pretty-prints. Minify makes one line. Validate copies the input only if it parses.
Copy Output copies the right-hand box. The character and line counts are for that box.
Counts are for the sample that is on screen when the page opens, then for one click of Format or Minify with sort left off.
| Setting | This formatter |
|---|---|
| Parser | JSON.parse |
| Printer | JSON.stringify |
| Indent | 0–8 spaces, default 2, Format only |
| Sort | Off. Object keys only, via localeCompare |
| Validate | Parse check, then a raw copy of the input |
| Sample | 6 lines, 113 characters, already in both boxes |
| After Format on the sample | 10 lines, 129 characters |
| After Minify on the sample | 1 line, 94 characters |
| Live update | No. Each button runs once |
| Storage | Browser only |
Indent and sort are read at click time. They do not rewrite the output by themselves.
0 to 8. Used by Format only. 0 matches Minify. The box starts at 2.
Off. Applies on the next Format or Minify, recursively, with localeCompare. Arrays stay in order.
JSON.parse, then JSON.stringify with the current indent. On the sample, the array moves onto its own lines.
The same parse, then JSON.stringify with no extra space. Indent is ignored. Sort still applies if it is on.
JSON.parse only. Success copies the input unchanged. Failure shows the parser message and keeps the old output.
Empties both boxes and the stored error. Stats become 0 characters and 0 lines.
What both boxes contain before any click. 113 characters, 6 lines.
{
"name": "Muxgen",
"category": "utility",
"features": ["format", "minify", "validate"],
"active": true
}129 characters, 10 lines. The array is expanded. The key order is unchanged.
{
"name": "Muxgen",
"category": "utility",
"features": [
"format",
"minify",
"validate"
],
"active": true
}94 characters, 1 line.
{"name":"Muxgen","category":"utility","features":["format","minify","validate"],"active":true}Keys become active, category, features, name. The three feature strings stay in their original order.
{
"active": true,
"category": "utility",
"features": [
"format",
"minify",
"validate"
],
"name": "Muxgen"
}Three buttons, three different writes to the output box.
| Button | Output | Sort |
|---|---|---|
| Format | Pretty-print with the indent | Sorts if the box is checked |
| Minify | One line, no extra spaces | Sorts if the box is checked |
| Validate | Exact copy of the input | Ignores indent and sort |
Rules of JSON.parse on this page, not extra repairs.
| Input | Result |
|---|---|
| Comments and trailing commas | Rejected. They are not JSON. |
| Single quotes | Rejected. Strings use double quotes. |
| Duplicate keys | The last value is kept. |
| Integers past ±9007199254740991 | May round to a JavaScript number. |
| Arrays | Order is kept, even when keys are sorted. |
| Schema | Not checked. Valid here means JSON.parse succeeded. |
Short definitions for the words on this page.
The text this page parses. Comments, trailing commas, and single quotes are outside it.
Parse, then print with the chosen number of spaces. Indent 2 puts each array item on its own line.
Parse, then print with no added space. The sample becomes one 94-character line.
A JSON.parse check. Success replaces the output with the input as typed.
The comparison used when Sort object keys is on. It follows the browser’s locale.
The loaded sample, what Format does to its array, how sort and validate differ, and what JSON.parse rejects.
Explore more tools in the directory.