UTILITIES NEWBIE

Digital tools

JSON Formatter & Beautifier

Turn a compact JSON document into readable, indented output while keeping your original source for comparison.

Input

Import a local text file

0 UTF-16 code units

Optional local draft

Saving stores a plaintext draft in this browser on this device. Do not save secrets or use this on a shared device. Nothing is saved or loaded automatically. Reset does not delete a saved draft; use Delete local draft.

No draft has been loaded.

Output

Formatted room record with a text label, numerical capacity and boolean flag. Full explanation follows.
Two-space formatting exposes the three fields without changing their types. Text explanation

Text explanation. The compact fixture contains room as the string Studio, seats as the number 12, and open as the boolean true. The verified two-space output places these three properties on separate lines within one object. The quotation marks around Studio distinguish text from the unquoted number and boolean. Formatting does not verify whether the room or its stated capacity is real.

Read a JSON document without losing track of its meaning

Guide updated

Start with a complete JSON value

Compact JSON can be difficult to follow because its brackets and values run together. This formatter adds indentation so that you can see which properties belong to an object and which values belong to an array. It is useful when inspecting a small exported record or an example response. Formatting changes presentation; it does not check whether a person's name, a stock quantity, or another fact in the document is correct.

Paste the whole document into the input, rather than a fragment copied from the middle of an object. JSON uses double quotes around property names and text values. An object or array is common, but a single valid string, number, boolean or null is also a JSON document. Empty input is not. If your source is JavaScript with comments or single-quoted strings, it needs deliberate correction before this strict JSON formatter can accept it.

Follow a small example

For a practice record, enter the compact document below and choose two spaces. The output places each property on its own indented line. The room name remains text, the seats value remains a number, and the open value remains a boolean. Those differences matter when another program reads the result; adding quotes around a number is not a harmless layout change.

{"room":"Studio","seats":12,"open":true}
{
  "room": "Studio",
  "seats": 12,
  "open": true
}

Choose three or four spaces if that makes nesting easier to read. The setting changes the indentation width, not the number of array entries or their order. Check the beginning and end of the output as well as the part you were investigating. A nicely formatted document can still be the wrong record for your task.

Understand a rejected input

A comma immediately before a closing brace is invalid JSON. Remove that comma only after checking that a property was not accidentally omitted. Duplicate object keys are rejected too: otherwise a reader might silently keep one value and discard another. The formatter also rejects unsafe integers rather than presenting a changed large identifier as if it were exact. Store identifiers as strings when that is what the receiving system requires; do not change their type merely to silence an error.

The formatter does not repair malformed documents or validate them against a JSON Schema. If the text is already valid but you want compact output, use JSON minifier. If you need to inspect differences between two parsed values, use JSON value comparison. These are different jobs, and choosing the intended tool avoids confusing a successful formatting result with a successful comparison or business-rule check.

Know which details can change

The parser reads the JSON value before writing it again. Layout whitespace and the original spelling of numbers can change. Exponential notation may become an ordinary decimal representation. Array order and decoded string values are retained, but the result is not a byte-for-byte archive of the source. Keep the original file if exact text, signatures, or an audit trail matters. Review the receiving system's requirements before replacing a configuration with reformatted output.

The input limit is 100,000 UTF-16 code units, while an imported UTF-8 file has a separate 100,000-byte limit. Non-ASCII text can use several bytes per character, so a file can reach its limit before the editor appears full. Documents are also bounded to 10,000 values and 40 nesting levels; output is limited to 1,000,000 code units. Splitting a document must preserve complete valid values, not cut arbitrarily through brackets or strings.

Read the shape before editing a value

The illustration separates the three properties in the practice record by their role. The room is a label, the seats field is a quantity, and open is a yes-or-no value. All three belong inside the same outer object. Indentation helps your eye find that boundary, but it does not add relationships that were missing from the source. First locate the opening brace and its matching closing brace. Then follow one property at a time, including the comma that separates it from the next property.

A useful way to check a nested example is to describe it aloud before changing it. In the second practice record below, enabled is false, note has no supplied value, code is a text identifier, and items is an ordered list. A false value is different from a missing property, and null is different from an empty string. The formatter exposes those written distinctions; it cannot decide which one your application expects. If a field looks surprising, compare it with the source that produced the record.

{"enabled":false,"note":null,"code":"001","items":["Tea","Cake"]}

The identifier in this example is enclosed in quotes because its leading zeros belong to the code. They are not spare decoration. By contrast, the seat count in the first example is a number. Changing both fields to strings just to make their appearance consistent would change the data types. When practicing, compare the quotation marks as carefully as the indentation. A copied number that looks right in a message may still be the wrong type when pasted into a program.

Recognize what a line break means

There are two different kinds of apparent line break in JSON. Whitespace between properties can be changed to make the document easier to read. A newline belonging to a string is data and must be represented using the appropriate escape sequence. A literal unescaped line break inside a quoted string is not valid JSON. The formatter does not turn a multiline note into valid source on your behalf. Correct the source representation while preserving the intended note, rather than deleting its content to make parsing succeed.

Similarly, square brackets mean an array, not a decorative way to group several unrelated documents. Formatting a list of three values leaves three values in the same order, including repetitions. It neither deduplicates the list nor ranks its entries. This matters when a list is a sequence of steps or positions. If you need a different operation, keep the formatted copy as a reading aid and choose that operation separately, with its own expected result.

Use the result in a small, explainable workflow

For a room-booking example, use formatting to inspect whether the room label, capacity and open flag are present in an exported test record. It can help a colleague see those fields without searching a long compact line. It cannot confirm that the room exists, that the capacity is current, or that booking is permitted. Write those questions separately instead of calling the entire record validated after the Format JSON button succeeds.

For a support question, reduce a failing document to a small complete example that retains the relevant structure. Replace private names with invented ones while keeping their types. Keep a problematic number as a number if numerical interpretation is what you are investigating. Once the example works, compare its output with the expected structure and keep the unsuccessful version separately. That gives someone reviewing the issue a clear explanation of what changed without requiring your original private file.

Before handing over a reformatted file, decide what the recipient needs to check. The practice room record offers three simple checkpoints: the label still says Studio, the capacity is still twelve, and the flag is still true. Record the indentation choice if presentation matters. Inspect the saved file or pasted text itself, rather than only the result panel. Keep the original until the receiving application has accepted the replacement under its own rules.

Keep the source and export deliberately

Use Copy output or Download output after checking the result. If clipboard access is unavailable, select the output text and copy it using your browser. Reset clears the current inputs and results. Where you choose to save a local draft, that draft is plaintext in this browser and must be removed with Delete local draft; resetting the editor does not delete it. Use non-sensitive practice data and consult the site's Privacy Policy before processing information that should not appear in a web page.

Additional worked examples

Worked examples

Input and settings

{"name":"Ada","roles":["editor","reader"]}

Expected output

{
  "name": "Ada",
  "roles": [
    "editor",
    "reader"
  ]
}

The two-space example adds layout whitespace. The two array items remain in their original order.

A trailing comma is rejected

{"ready":true,}

The comma before the closing brace is not valid JSON. Remove it to use {"ready":true}, then select Format JSON again. Formatting does not repair or silently reinterpret invalid input.

Related tools

JSON validator · JSON minifier · JSON value comparison

Find a tool

Type a tool name, such as JSON or percentage.

Quick links

Browse by category

All tools