How to use
- Paste JSON, open a file, or try the sample.
- Adjust the settings. The result updates as you type.
- Copy or download the formatted result.
Understanding JSON
JSON is a text format for exchanging structured data. You will often encounter it in API responses, configuration files, and exported records. Its small set of value types makes it practical to move data between different programming languages.
Formatting makes that structure easier to inspect. Indentation shows which values belong together; line breaks make nested records easier to scan. These layout choices do not change the data represented by a valid document.
Values and structure
A JSON document contains one value. That value can be an object or array, but a string, number, boolean, or null is also valid at the root. Objects associate string names with values; arrays contain values in a meaningful sequence. Both can be nested.
| Type | Example | Meaning |
|---|---|---|
| Object | {"name": "Ada"} | Named properties inside braces. |
| Array | ["red", "blue"] | An ordered sequence inside brackets. |
| String | "Hello, world" | Text enclosed in double quotes. |
| Number | -12.5e2 | A decimal number, optionally with an exponent. |
| Boolean | true / false | One of two logical values. |
| Null | null | An explicit null value; not an omitted property. |
The syntax to get right
Use double quotes for property names and strings. A colon separates a name from its value; commas separate object members and array items. Do not add a comma after the last member or item. Comments, single quotes, and JavaScript expressions are outside strict JSON.
The literals true, false, and null are lowercase. Numbers use decimal notation with an optional minus sign, fraction, and exponent. Leading zeros, a leading plus sign, NaN, and Infinity are invalid. Within strings, escape quotation marks, backslashes, and control characters; a newline must be written as an escape such as \n.
Object names should be unique for reliable interchange. Different consumers may keep different values when names repeat. The formatter reports duplicates and preserves them so you can decide how to resolve them. A syntax check alone cannot confirm that a document matches an API contract or JSON Schema.
What formatting preserves
DevToolsy validates the input and adjusts whitespace around its original tokens. It retains number text such as 900719925474099312345, 19.9900, 1e+400, and -0, along with the original string escapes. This avoids rounding caused by parsing and reserializing numbers as JavaScript floating-point values. The application that reads the result still determines its own numeric precision.
Indentation, LF or CRLF line endings, and a final newline are output conventions. Sort keys is a separate, optional change: it recursively orders object members by decoded names using a deterministic, case-sensitive comparison. Array order and the relative order of duplicate names stay intact. This is for reading and diffs; it is not a canonicalization scheme for cryptographic signatures.
{"name":"Ada","roles":["developer","reviewer"],"active":true}{
"name": "Ada",
"roles": [
"developer",
"reviewer"
],
"active": true
}Indentation changes the presentation. The property names, values, and array order stay the same.
Up to 5 MiB of UTF-8 input, 20 MiB of output, 128 nesting levels, 250,000 scanned tokens, and 10 seconds per run. Large documents may need a more capable device.
Frequently asked questions
Does auto format change my input?
No. It updates the read-only result after a brief pause while leaving the input as you wrote it. Auto format is on initially. Turn it off to run manually with Format JSON or Ctrl/⌘ + Enter.
What happens while my JSON is incomplete?
The last valid result remains visible while you edit. Copy and Download are disabled until the current input and settings produce a valid result. Select an error to jump to its location in the input.
Will formatting round large numbers or change string escapes?
No. Original number tokens and string escape spelling are preserved. This includes long integers, trailing decimal zeros, exponent notation, and negative zero. Other applications may interpret those numbers with different precision.
Does sorting keys also reorder arrays?
No. Sort keys applies recursively to objects only. Arrays retain their sequence, and duplicate names retain their relative order. Sorting is off by default.
Can the formatter fix comments or trailing commas?
It accepts strict JSON and reports invalid syntax instead of guessing a repair. Comments, single-quoted strings, unquoted keys, and trailing commas need to be corrected in the input.
Is JSON Beautifier the same as JSON Formatter?
Yes. On this page, beautify, pretty-print, and format all mean adding readable indentation and line breaks to JSON. For a compact document, use JSON Minifier.
Does my JSON leave my device?
Pasted text and local files are processed in your browser. DevToolsy does not upload your JSON or save a document history. Copy or download the result before leaving if you need to keep it.