JSON Formatter & Validator

Format, validate, minify, and view JSON with a collapsible tree.

What JSON Formatter & Validator helps you do

Inspect API responses, configuration values, and structured payloads without pasting them into a remote dashboard. Format readable JSON, minify it for transport, validate its syntax, or explore nested arrays and objects in a collapsible tree. It is a quick local workbench for the payload you are about to debug, commit or send.

JSON is parsed, formatted and explored in your browser. The payload is never uploaded to Haivix, and nothing is stored after the page is closed.

How it works

The tool calls the browser's JSON parser to validate the input, then serializes the result with indentation for the formatted view or without whitespace for the minified view. The tree view walks the parsed value recursively and creates collapsible nodes for objects and arrays. Because the parser is the same one the browser uses for fetch responses, its error messages match the runtime you are debugging.

How to use JSON Formatter & Validator

  1. Paste the response body and run Validate first.
  2. Read the parser error and fix missing quotes, commas, brackets, or escapes.
  3. Use Format for a readable copy, Viewer for nested exploration, or Minify for transport.
  4. Copy or download the result before clearing the input.

When to use it

  • Inspect an API response without opening a network tab or a remote dashboard.
  • Format a config file or fixture before committing it.
  • Find the exact position of a syntax error in a large payload.
  • Explore a deeply nested response to find the field you need.
  • Minify a value before pasting it into an environment variable.
  • Compare the shape of two payloads before writing a parser.

When not to use it

  • Do not use it to validate against a schema; syntax correctness is not contract correctness.
  • Do not paste secrets or personal data into any page if the machine may be shared.
  • Do not expect it to repair malformed JSON; it reports the problem instead.

Example

An API response returns a 500 with a payload that looks almost valid. The validator points to line 14, where a trailing comma sits before a closing brace. Removing the comma makes the payload parse, and the tree view then shows that the error object is nested under a wrapper rather than at the top level.

What you can do with JSON Formatter & Validator

  • Pretty-print valid JSON with two-space indentation.
  • Minify JSON into a compact single-line representation.
  • Validate syntax and display the browser parser error for invalid input.
  • Explore nested objects and arrays in a collapsible tree.
  • Copy the formatted or minified result to the clipboard.
  • Download the output as a file for a fixture or a bug report.

Example: debug an API response

Paste the response body and run Validate first. If it fails, use the reported parser position to look for missing quotes, commas, brackets, or invalid escape sequences.

After the payload is valid, use Format for review or Viewer for nested data. Minify only when you need a compact value for a request, environment variable, fixture, or log comparison.

When the payload is large, collapse the top level first and open only the branch you need. That keeps the tree readable and avoids scrolling through unrelated arrays while you compare two fields.

What to know before you start

  • JSON does not support comments, trailing commas, undefined values, or single-quoted strings.
  • Validation confirms syntax, not whether the fields match an API contract or JSON Schema.
  • Very large payloads can still consume significant browser memory even though the data is processed locally.
  • The formatter preserves the data it parses; it does not sort keys, coerce types or repair values.

Common mistakes

  • Assuming a successful parse means the response matches the API contract.
  • Leaving a trailing comma after the last property.
  • Using single quotes or unquoted keys from a JavaScript object literal.
  • Pasting a JavaScript object that contains comments or undefined values.
  • Minifying before checking the payload, which makes the error harder to locate.
  • Forgetting that duplicate keys are allowed by the parser but may behave differently in the consumer.

Troubleshooting

If validation fails with an unexpected token, check the character at the reported position and the one just before it; the real problem is often a missing comma on the previous line.

If the tree feels slow, the payload may be very large. Collapse the root and work down one branch at a time.

If the input parses but looks wrong, the source may contain duplicate keys or values encoded as strings. The formatter shows what the parser kept, not what the producer intended.

If the browser reports an out-of-memory error, split the payload or inspect it with a command-line tool; the page holds the whole value in memory.

If copy fails, select the formatted text manually. Clipboard access can be restricted in some browser contexts.

Related standards and documentation

  • RFC 8259 defines JSON, including the fact that comments and trailing commas are not part of the format.
  • JSON Schema is a separate vocabulary for describing the shape of a payload; it is not checked here.
Syntax first, structure second
  • Validate before formatting or minifying.
  • The parser error points at the likely line.
  • A valid payload can still break the API contract.

Frequently Asked Questions