b2KIT

JSON Formatter & Validator

Format, validate, and minify JSON data with syntax highlighting, tree view, and error reporting.

Tested tool guide Tested browser tools Checked August 16, 2026

What JSON Formatter & Validator does, with a checked example

A visually plausible data object can still fail JSON syntax because of one single quote, trailing comma, or bare property name. JSON Formatter & Validator reads pasted JSON, reports malformed syntax, and, for valid input, can produce an indented or minified representation. Syntax highlighting makes token roles visible, while tree view reveals object and array nesting. The common surprise is that JSON is stricter than a JavaScript object literal: comments, single-quoted strings, undefined, and trailing commas are not valid JSON.

Worked example

A concrete input and expected output from the current implementation.

Input

{
  "active": true,
  "scores": [2, 5]
}

Expected output

{"active":true,"scores":[2,5]}

For the minify operation, whitespace between tokens is removed. The boolean stays true, the array still contains the numbers 2 and 5 in that order, and the property names remain unchanged, so the result represents the same JSON value.

How the result is produced

1

Syntax validation

The validator reads the entire pasted text as one JSON value. Objects, arrays, strings, numbers, true, false, and null are accepted when their punctuation and escaping follow JSON syntax. Malformed input produces an error report instead of a reliable formatted or tree representation. This pass checks grammar only; it does not know an application's required fields or permitted values.

2

Formatting and views

Format adds layout whitespace and indentation so nested arrays and objects are easier to scan. Minify removes insignificant whitespace between JSON tokens; whitespace characters inside quoted string values are data and are not the whitespace targeted by minification. Syntax highlighting distinguishes token types, and tree view exposes nesting without changing the represented structure. These output modes do not perform schema validation or create a canonical serialization.

Good uses

  • Validate an API request body copied from a log before sending it again, especially after manually editing commas, quotes, or braces.
  • Expand a compact configuration or response into indented text and tree view to inspect deeply nested arrays and objects.
  • Minify a known-valid JSON fixture or payload when human-readable indentation is unnecessary but string values must remain intact.

Limits and checks

  • A successful syntax result says only that the text is JSON. It does not verify a JSON Schema, required properties, endpoint-specific types, identifier formats, or relationships between fields.
  • Object member names should be unique. A document with duplicate names may be accepted as syntactically valid, yet consumers can handle those duplicates differently, so validation does not make such input interoperable.
  • JSON syntax does not guarantee that every consumer can represent every accepted number exactly. Large integers and high-precision decimals can be rounded or rejected downstream, so successful validation does not prove numeric compatibility.

Common questions

Can this turn a JavaScript object literal into JSON?

Not reliably. A JavaScript literal may contain single-quoted strings, unquoted keys, comments, trailing commas, undefined, NaN, Infinity, methods, or expressions, none of which are valid JSON values or syntax. Convert those constructs deliberately first; use this tool to validate and format the resulting JSON text, not to execute JavaScript.

Does valid JSON mean my API or configuration file will accept it?

No. Validity here concerns JSON syntax. The receiving system can still require particular property names, types, ranges, enum values, or nesting, and it may reject unknown fields. Check that system's contract or JSON Schema separately; this tool answers whether the text is JSON and helps you inspect its structure.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools