Back to Blog

    JsonifyTools field guide

    How to Format JSON Online: Readable Examples and Common Fixes

    Learn how to format minified JSON, read nested objects, and tell pretty printing apart from validation with practical examples.

    By JsonifyTools4 min read
    READABLE STRUCTURE: { data } — minified → formattedONE LINEINDENTEDREADABLE STRUCTURE{ data }minified → formatted
    A diagram illustrating minified → formatted.
    1. 1Paste or load JSON
    2. 2Parse the input
    3. 3Read the indented result
    Format JSON in the Viewer

    What JSON formatting changes

    JSON syntax does not require spaces or line breaks between tokens. Minifiers remove optional whitespace to reduce payload size. A formatter parses the JSON value and writes it back with consistent indentation, line breaks, and spacing. It should preserve values and array order; object key order is generally not meaningful to JSON consumers.

    Minified

    Minified
    {"order":{"id":"ord_1042","status":"packed","items":[{"sku":"MUG-02","quantity":2}],"shipping":{"country":"CA","priority":false}}}

    Formatted

    Formatted
    {
      "order": {
        "id": "ord_1042",
        "status": "packed",
        "items": [
          { "sku": "MUG-02", "quantity": 2 }
        ],
        "shipping": {
          "country": "CA",
          "priority": false
        }
      }
    }

    Here the indentation exposes that items is an array of objects and shipping is a separate nested object. The data itself has not gained fields or changed types.

    How indentation reveals nesting

    Each additional indentation level means the parser is inside another object or array. Matching closing braces line up with the opening structure. A compact object on one line can still be valid; the layout is for people and tools that compare text.

    One level at a time

    { "order": { ... } }root object
    "items": [ ... ]child array
    { "sku": "MUG-02" }array element

    Format JSON online

    Open the JSON Viewer, paste the complete payload, and use its format action or switch to the tree view to inspect nested values. The tool has formatting, validation, and tree inspection capabilities. If you only need indentation, copy the formatted output back into your editor.

    Formatting is not the same as validation

    To pretty print JSON, a formatter must parse it first. That parse step can tell you whether the text follows JSON syntax. It does not prove the payload has the fields your application expects. A syntactically valid response with "quantity": "2" may still violate an API contract expecting a number.

    What formatting preserves—and what it may normalize

    Indentation is whitespace outside strings, so adding it does not change string values. A formatter should also leave array order intact. However, formatting is a parse-and-serialize step, not a byte-for-byte edit: a serializer may reorder object keys or normalize a number such as 1.00 to 1. Those representations parse to the same JSON number, but the original text is different. If a signature, checksum, or exact text comparison depends on the original bytes, keep that source and do not substitute pretty-printed output.

    Indent size is a readability preference, not part of the JSON format. Two spaces are compact enough for deeply nested responses; four spaces can be easier to scan in a narrow code review. Pick one convention for the repository and use the same setting before comparing files. Reformatting both sides first removes whitespace-only noise from a textual diff.

    Common formatting problems

    If nothing happens or the tool reports an error, check that you copied the entire response, including its first and last braces. Trailing commas, comments, single-quoted strings, and literal line breaks inside strings are not valid JSON. A formatter cannot safely guess what malformed text was intended to mean.

    Pretty printing is especially useful when comparing API responses across environments, reviewing a webhook payload, or finding whether a field is nested under data or at the root. For giant files, formatting everything can make the output much larger; search or inspect selected subtrees instead.

    Small valid example
    {"ok":true,"count":3,"tags":["new","ready"]}